Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - lashtear

#1
Help / Re: Mac and certain Ubuntu Crashing with my mods
February 08, 2018, 07:32:05 PM
Sorry for thread necromancy, but I've encountered similar issues with other mods using Harmony to patching things and then crashing on Linux.

I found http://www.mono-project.com/docs/debug+profile/debug/#debugging-with-gdb to be quite helpful for getting slightly more useful data out of gdb in these situations.  No logs are generated because the mono vm itself crashes hard, often with SIGILL.

I recommend attaching to the already-started process with gdb (e.g. gdb /path/to/executable pidnumber) or launching from within gdb.  For example, on debian/ubuntu/etc systems with the pidof command:


$ p=$(pidof RimWorldLinux.x86_64); gdb /proc/$p/exe $p


will launch you into an interactive debugging session on the currently running game (and freeze it).  To continue, then do:


(gdb) handle SIGXCPU SIG33 SIG35 SIG36 SIGPWR SIGSEGV nostop noprint pass
(gdb) cont


and the game will proceed until you crash/exit/etc.  The page I linked points out some handy gdb scripts for using the existing mono function for stack introspection: mono_mpip(void*).  Using their example gdb script for unwinding the stack and showing recognizable mono frames,


define mono_backtrace
select-frame 0
set $i = 0
while ($i < $arg0)
   set $foo = (char*) mono_pmip ($pc)
   if ($foo)
     printf "#%d  %p in%s\n", $i, $pc, $foo
   else
     frame
   end
   up-silently
   set $i = $i + 1
end
end


Then we can do things like


Thread 1 "RimWorldLinux.x" received signal SIGILL, Illegal instruction.
0x00000000404cf233 in ?? ()
(gdb) bt
#0  0x00000000404cf233 in  ()
#1  0x00007fffbc035f75 in  ()
#2  0x00007ffeeecdca00 in  ()
#3  0x00000000404cf220 in  ()
#4  0x00007fffffffa860 in  ()
#5  0x0000000040811454 in  ()
#6  0x00007fff3f726ee0 in  ()
#7  0x000000004063745e in  ()
#8  0x00007fff3c402708 in  ()
#9  0x00007fff4cd1f3c0 in  ()
#10 0x00000000026dbcb1 in  ()
#11 0x00007ffff7fcba60 in  ()
#12 0x00007fff42383200 in  ()
#13 0x0000000040810eb1 in  ()
#14 0x0000000000000000 in  ()
(gdb) mono_backtrace 14
#0  0x00000000404cf233 in ?? ()
#1  0x7fffbc035f75 in (wrapper dynamic-method) Verse.AI.MentalState:PostStart_Patch1 (object,string) + 0x15 (0x7fffbc035f60 0x7fffbc035f7a) [0x7fffefba4d48 - Unity Root Domain]
#2  0x00007ffeeecdca00 in ?? ()
#3  0x404cf220 in Verse.AI.MentalState:PostStart (string) + 0x0 (0x404cf220 0x404cf229) [0x7fffefba4d48 - Unity Root Domain]
#4  0x00007fffffffa860 in ?? ()
#5  0x40811454 in Verse.AI.MentalStateHandler:TryStartMentalState (Verse.MentalStateDef,string,bool,bool,Verse.Pawn) + 0x4b4 (0x40810fa0 0x4081175f) [0x7fffefba4d48 - Unity Root Domain]
#6  0x00007fff3f726ee0 in ?? ()
#7  0x4063745e in Verse.Game:GetComponent<object> () + 0xae (0x406373b0 0x406374ec) [0x7fffefba4d48 - Unity Root Domain]
#8  0x00007fff3c402708 in ?? ()
#9  0x00007fff4cd1f3c0 in ?? ()
#10 0x00000000026dbcb1 in ?? ()
#11 0x00007ffff7fcba60 in ?? ()
#12 0x00007fff42383200 in ?? ()
#13  0x40810eb1 in RimWorld.LordToil_PanicFlee:Init () + 0xb1 (0x40810e00 0x40810ee2) [0x7fffefba4d48 - Unity Root Domain]


I suspect this is a problem with Harmony, how Harmony is being used, Mono, or all of the above.
#2
Quote from: Jamestec on October 23, 2016, 01:05:27 AM
Since the crash happens after the methods are replaced using CCL/RawCode's code, I think it could be my use of Reflection.
I've attached a special version which doesn't use Reflection and thus cannot compare the stuff of two things (marble walls can replace marble walls for no reason). Try using this version and please report whether it works or not.
In my recent attempt at another mod (JTBuildDiagonally), I did come across hanging when using Reflection, but the hang happened when I close the game or go to menu.

Just tested this version; works great!  More specifically, I did the test I had before with just core and JTReplaceWalls, but now using the one you linked.  I can select things to place, place them, and even do this for walls.
#3
Hi!  I'm one of the people that squawked on steam about trouble.  Here's more detail about what I'm seeing, and steps to reproduce:

Using only Core (i.e. the default game) and JTReplaceWalls.  Create a new map.  Once the map loads, click Architect->Furniture.  The moment I click Sleeping spot, it immediately crashes mono hard.

https://gist.github.com/lashtear/ed40047974f22c8cea4866ecd6cf047c has a copy of the resulting /tmp/rimworld_log output, which includes a gdb trace.  In quick summary of that trace:

42 threads: 4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,40,41,42,43,44,45,46,47,48: futex_abstimed_wait_cancelable:205 start_thread:333 clone:105
  2 threads: 39,49: nanosleep:84 usleep:32 start_thread:333 clone:105
  1 threads: 37: poll:84 pa_mainloop_poll pa_mainloop_iterate pa_mainloop_run start_thread:333 clone:105
  1 threads: 2: start_thread:333 clone:105
  1 threads: 1: readv:84 read
  1 threads: 3: futex_abstimed_wait_cancelable:205 mono_sem_wait start_thread:333 clone:105
  1 threads: 38: pa_threaded_mainloop_wait pa_simple_write start_thread:333 clone:105


Thread 1 being (I believe) the interesting one there; pa_* is PulseAudio stuff setup by fmod (for sound) and the futex details are thread primitive infrastructure for locks and semaphores.

Again, this is just Core and JTReplaceWalls:
$ cat ~/.config/unity3d/Ludeon\ Studios/RimWorld/Config/ModsConfig.xml
<?xml version="1.0" encoding="utf-8"?>
<ModsConfigData>
  <buildNumber>1284</buildNumber>
  <activeMods>
    <li>Core</li>
    <li>779984226</li>
  </activeMods>
</ModsConfigData>

$ uname  -a
Linux chrysalis 4.7.0-1-amd64 #1 SMP Debian 4.7.6-1 (2016-10-07) x86_64 GNU/Linux


You may notice a great deal of smoke in the log about steam overlay trouble; that's apparently not related, as even when signed out of steam and overlay-disabled, the problem is still easy to reproduce.

I wish I could give more C#-friendly diagnostics... but it's crashing the mono VM itself.  Hardware is stable, no overclocking or memory issues-- but something does not like the CCL-style changes you're making on the 64bit Linux port.

Plenty of other Unity games run fine, and RimWorld is quite stable for me except for this one mod.  Anything else I can do to help?