[0.18.1722 Linux x64 + mods] Game lockup / unhandled NULL exception/funlockfile

Started by jooe, November 27, 2017, 02:43:02 PM

Previous topic - Next topic

2.71828

Thanks for your advice, but I'm sure that I had RW working with your mod on Linux (I subscribed on 18 Nov 2017), with it already being relatively high on the priority list already, for a few hours before I got my crashes, so I don't think your mod is the culprit. In any case, I already spent too much time trying to make B18 work on Linux, so before there's any kind of feedback from one of the Devs, I won't fiddle around with it anymore.

In any case, thanks for the tip and thank you for your mods! I already had lots of fun with 'RunAndGun' and can't wait to try out your 'Giddy-up!' series some time in the (hopefully not so distant) future.

Madman666

Been getting those weird crashes with Run And Gun @Roolo mentioned as soon as raiders try to flee at first I was assuming steam just autoruns 32 bit version and its a memory crash, but after a bit of research came to conclusion its this same issue. Was Run and Gun working fine on Linux with A17 version? If thats so, it just means something is damn wrong with new version then and all I can do is wait for next version, which might fix itself. It works fine on Windows and as soon as I turn RunAndGun off in Linux - its works fine even on Linux - no crashes whatsoever regardless of how many mods I use.

I'll miss shooting on the run, but oh well. I really hope there won't be more problems like that one.

Roolo

Really strange, but running the game trough gdb completely solved this issue for me:

For anyone who wants to try this workaround but doesn't know how to run Rimworld through gdb:
In the command line go to the Rimworld main directory. cd ~/.local/share/Steam/steamapps/common/RimWorld
type gdb

now in gdb, type:
exec-file ./RimWorldLinux.x86 (you only need to do this once)
run ./start_RimWorld.sh

Madman666

Interesting... I am not prepared typing that in every time i'll wanna play RW though, but thats something at least. I guess i ll try if that does it for me.

Roolo

I just solved the crashing issue for RunAndGun.

Apparently, this issue occurs when Harmony is used to patch an (implemented) virtual method. Doing this works fine on Windows, but may cause crashes on Unix systems. I recommend any modders to avoid patching virtual methods until this issue is resolved in Harmony.

Madman666

Quote from: Roolo on February 09, 2018, 09:14:00 AM
I just solved the crashing issue for RunAndGun.

Apparently, this issue occurs when Harmony is used to patch an (implemented) virtual method. Doing this works fine on Windows, but may cause crashes on Unix systems. I recommend any modders to avoid patching virtual methods until this issue is resolved in Harmony.

Wow, thats good news!) Thanks for your patience looking into it!

2.71828

Quote from: Roolo on February 09, 2018, 09:14:00 AM
I just solved the crashing issue for RunAndGun.

Apparently, this issue occurs when Harmony is used to patch an (implemented) virtual method. Doing this works fine on Windows, but may cause crashes on Unix systems. I recommend any modders to avoid patching virtual methods until this issue is resolved in Harmony.

Thank you for your work, but if you really managed to fix your issues, then I don't think that RunAndGun was the (only) culprit. Yesterday I thought I might try out Rimworld again after a couple of month hiatus, but Rimworld still crashes randomly. Just now, I got ye olde 'unhandled NULL exception' again (on an new save), although I (should) have the latest version of RunAndGun and have it pretty high in the load order:

Receiving unhandled NULL exception
#0  0x007ffec6486e80 in funlockfile
#1  0x007ffec6487428 in std::vector<core::basic_string<char, core::StringStorageDefault<char> >, std::allocator<core::basic_string<char, core::StringStorageDefault<char> > > >::~vector()
#2  0x007ffec6487438 in operator new(unsigned long)
#3  0x007ffec6487458 in operator new(unsigned long)
#4  0x007ffec6487468 in __run_exit_handlers
#5  0x007ffec64874b8 in exit
#6  0x007ffec64874c8 in mono_thread_exit
#7  0x007ffec64874d8 in mono_method_marked_as_wrapperless
#8  0x007ffec6487798 in mono_amd64_throw_exception


Could this be another mod (mis)using Harmony? Or can this happen if there are just too many mods? Currently, I have about ~250 mods active (although I didn't play Rimworld for a couple of month, I did add the occasional new mod here and there...). Does Rimworld just crash with an 'unhandled NULL exception' if it runs out of RAM? I think I was at about 1.2 GB of RAM, maybe 1–2 minutes before the crash, less than 10 minutes after the safe was loaded. That shouldn't be a problem on a 64bit OS, should it?

Madman666

Do you perhaps use Rimstory mod? I got those crashes when i was using that. Fixed once i disabled it.

Roolo

Quote from: 2.71828 on May 20, 2018, 11:32:32 AM
Quote from: Roolo on February 09, 2018, 09:14:00 AM
I just solved the crashing issue for RunAndGun.

Apparently, this issue occurs when Harmony is used to patch an (implemented) virtual method. Doing this works fine on Windows, but may cause crashes on Unix systems. I recommend any modders to avoid patching virtual methods until this issue is resolved in Harmony.

Thank you for your work, but if you really managed to fix your issues, then I don't think that RunAndGun was the (only) culprit. Yesterday I thought I might try out Rimworld again after a couple of month hiatus, but Rimworld still crashes randomly. Just now, I got ye olde 'unhandled NULL exception' again (on an new save), although I (should) have the latest version of RunAndGun and have it pretty high in the load order:

Receiving unhandled NULL exception
#0  0x007ffec6486e80 in funlockfile
#1  0x007ffec6487428 in std::vector<core::basic_string<char, core::StringStorageDefault<char> >, std::allocator<core::basic_string<char, core::StringStorageDefault<char> > > >::~vector()
#2  0x007ffec6487438 in operator new(unsigned long)
#3  0x007ffec6487458 in operator new(unsigned long)
#4  0x007ffec6487468 in __run_exit_handlers
#5  0x007ffec64874b8 in exit
#6  0x007ffec64874c8 in mono_thread_exit
#7  0x007ffec64874d8 in mono_method_marked_as_wrapperless
#8  0x007ffec6487798 in mono_amd64_throw_exception


Could this be another mod (mis)using Harmony? Or can this happen if there are just too many mods? Currently, I have about ~250 mods active (although I didn't play Rimworld for a couple of month, I did add the occasional new mod here and there...). Does Rimworld just crash with an 'unhandled NULL exception' if it runs out of RAM? I think I was at about 1.2 GB of RAM, maybe 1–2 minutes before the crash, less than 10 minutes after the safe was loaded. That shouldn't be a problem on a 64bit OS, should it?

Yeah RunAndGun was just one mod that was causing the issue, I never said it was the only culprit. It seems to happen when virtual methods are patched with harmony, and I expect more mods patch virtual methods (I don't think patching virtual methods with harmony always cause issues, but when moving my patch to a non-virtual method, the problem was solved for RunAndGun). I don't think many mod creators are aware of this, so I'm not surprised that it happens with more mods.   

2.71828

Quote from: Madman666 on May 20, 2018, 11:47:26 AM
Do you perhaps use Rimstory mod? I got those crashes when i was using that. Fixed once i disabled it.

Yes, that's one of the mods I added while I didn't play, because it sounded interesting. Did this, by any chance, also spawn a lot of error in your debug log? Later today I got Rimworld to work for a bit (I started it directly by 'LC_ALL=C ./RimWorldLinux.x86_64 -force-opengl'; I thought it might be worth a try) and it worked for a bit, although I got a lot of errors with a specific pawn, so I killed and resurrected him, and after that most errors were gone and I could play for a bit, before I shut Rimworld down for the moment. I actually suspected Psychology, or something. 

I just tried it again and got a CTD less than 10 seconds after unpausing. I guess I'll try disabling Rimstory and report back.


EDIT: No, I actually don't. I wanted to try it out, but it seemed like other mods I already used pretty much did what RimStory does already, so that's not the culprit.

Quote from: Roolo on May 20, 2018, 02:17:03 PM[...]
Yeah RunAndGun was just one mod that was causing the issue, I never said it was the only culprit. It seems to happen when virtual methods are patched with harmony, and I expect more mods patch virtual methods (I don't think patching virtual methods with harmony always cause issues, but when moving my patch to a non-virtual method, the problem was solved for RunAndGun). I don't think many mod creators are aware of this, so I'm not surprised that it happens with more mods.

Yes, I didn't want to imply that. Thanks for your work, anyway. I'll try Madman666's solution and report back.

I just think it's weird that I never had any of those problems under A17. Did nobody patch virtual methods before B18?

Multistream

I am getting this error when trying to create a colony, RimWorld crashes in process of generating map. When I press "start" and it crashes, it writes this to log:
Receiving unhandled NULL exception
#0  0x007ffff285c080 in funlockfile
#1  0x007ffff285c630 in (Unknown)
#2  0x007ffff285c640 in (Unknown)
#3  0x007ffff285c650 in (Unknown)
#4  0x007ffff285c660 in (Unknown)
#5  0x007ffff285c670 in (Unknown)
#6  0x007ffff285c680 in (Unknown)
#7  0x007ffff285c690 in (Unknown)
#8  0x007ffff285c6a0 in (Unknown)
#9  0x007ffff285c6b0 in (Unknown)
#10 0x007ffff285c6c0 in (Unknown)
#11 0x007ffff285c6d0 in (Unknown)
#12 0x007ffff285c6e0 in (Unknown)
#13 0x007ffff285c6f0 in (Unknown)
#14 0x007ffff285c700 in mono_set_defaults
#15 0x007ffff285db10 in mono_runtime_invoke
#16 0x007ffff285db40 in std::vector<core::basic_string<char, core::StringStorageDefault<char> >, std::allocator<core::basic_string<char, core::StringStorageDefault<char> > > >::~vector()
#17 0x007ffff285db70 in std::vector<core::basic_string<char, core::StringStorageDefault<char> >, std::allocator<core::basic_string<char, core::StringStorageDefault<char> > > >::~vector()
#18 0x007ffff285db90 in std::vector<core::basic_string<char, core::StringStorageDefault<char> >, std::allocator<core::basic_string<char, core::StringStorageDefault<char> > > >::~vector()
#19 0x007ffff285dd10 in operator new(unsigned long)
#20 0x007ffff285dd50 in std::vector<core::basic_string<char, core::StringStorageDefault<char> >, std::allocator<core::basic_string<char, core::StringStorageDefault<char> > > >::~vector()
#21 0x007ffff285dd70 in zcfree
#22 0x007ffff285eba0 in __libc_start_main
#23 0x007ffff285ec60 in zcfree

Sometimes it does not crash when creating colony, but I am not sure the exact reason so I am testing it right now
On windows I play with same set of mods, and it does not crash, however overall perfomance is worse.

Multistream

Lubuntu 18; So for me:
i3wm and windowed mode didn't work;
Launching using gdb gives me black screen
I tried launching rimworld 10 times, it successfully created new map only once and it was completely random. All the other times same error every time I create a map. I checked log file during map generation, but this did not give me any evidence of mod causing it
I don't have rimstory, run and gun or pathfinding mods.
EDIT: It once gave me this error somehow:
Receiving unhandled NULL exception
#0  0x007ffe2323f1c0 in funlockfile
#1  0x007ffe2323f75d in (Unknown)

Quote from: Roolo on February 09, 2018, 09:14:00 AM
I just solved the crashing issue for RunAndGun.

Apparently, this issue occurs when Harmony is used to patch an (implemented) virtual method. Doing this works fine on Windows, but may cause crashes on Unix systems. I recommend any modders to avoid patching virtual methods until this issue is resolved in Harmony.
Maybe we could use notepad++ find all in folder function to find all the mods using that method? Could you please paste an piece of code which is similar for all mods that patch virtual method?

Multistream

Still getting this error on 1.0
Receiving unhandled NULL exception
#0  0x007ffedcadee40 in funlockfile
#1  0x007ffedcadf3d8 in vasprintf
#2  0x007ffedcadf508 in g_free
#3  0x007ffedcadf5e8 in mono_method_full_name
#4  0x007ffedcadf678 in mono_debug_add_method
#5  0x007ffedcae1708 in mono_set_signal_chaining
#6  0x007ffedcae1758 in mono_set_defaults
#7  0x007ffedcae1838 in mono_set_defaults
#8  0x007ffedcae18d8 in mono_set_defaults
#9  0x007ffedcae18f8 in mono_set_defaults
#10 0x007ffedcae1a88 in mono_runtime_invoke
#11 0x007ffedcae1ab8 in mono_print_unhandled_exception
#12 0x007ffedcae1bc8 in mono_method_marked_as_wrapperless
#13 0x007ffedcae1e88 in mono_amd64_throw_exception
#14 0x007ffedcae2048 in (Unknown)

Tynan

I merged this into one thread and moved it to the Bugs forum.

I suspect it's a Unity issue. But we should review this.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

Multistream

1.0 released and I have different mod selection but still getting this, but now I can generate maps but I can't start game after generating pawns.

Receiving unhandled NULL exception
#0  0x007fd03c7f66c0 in funlockfile
#1  0x007fd03c7f6c48 in vasprintf
#2  0x007fd03c7f6d78 in g_free
#3  0x007fd03c7f6d98 in g_free
#4  0x007fd03c7f6e88 in mono_free_bstr
#5  0x007fd03c7f6ea8 in mono_type_get_desc
#6  0x007fd03c7f6ed8 in mono_type_full_name
#7  0x007fd03c7f6ef8 in mono_method_full_name
#8  0x007fd03c7f6f88 in mono_debug_print_stack_frame
#9  0x007fd03c7f6fc8 in mono_method_marked_as_wrapperless
#10 0x007fd03c7f7028 in mono_method_marked_as_wrapperless
#11 0x007fd03c7f72e8 in mono_method_marked_as_wrapperless
#12 0x007fd03c7f75a8 in mono_amd64_throw_exception
#13 0x007fd03c7f7768 in (Unknown)
#14 0x007fd03c7f7778 in (Unknown)
#15 0x007fd03c7f7788 in (Unknown)
#16 0x007fd03c7f7798 in (Unknown)
#17 0x007fd03c7f77a8 in (Unknown)
#18 0x007fd03c7f77b8 in mono_set_defaults
#19 0x007fd03c7f7d90 in mono_runtime_invoke
#20 0x007fd03c7f7dc0 in mono_thread_create
#21 0x007fd03c7f7e00 in mono_pthread_key_for_tls
#22 0x007fd03c7f7e20 in GC_start_blocking
#23 0x007fd03c7f7ec0 in start_thread
#24 0x007fd03c7f7f80 in clone

Hope that helps. Windows version works perfectly