godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.49k stars 21.07k forks source link

Mono godot_icall from Rpc from _Input causes crash #29812

Open cart opened 5 years ago

cart commented 5 years ago

Godot version: e21f808530b02a393a46d597afe89b4fbf886bb6

OS/device including version: Arch Linux

Issue description: This is a weird one. If you do an icall from within an RPC call from within an _Input, you get a crash. This behavior was not present in official 3.1 builds, but it is present in current master mono builds.

I hit this a number of times in my game High Hat. I was also able to reproduce it in a sample project.

carter@beemo ~/Repro_MonoCrash> godot.x11.opt.tools.64.mono
Godot Engine v3.2.dev.mono.custom_build.ee58126cd - https://godotengine.org
OpenGL ES 2.0 Renderer: GeForce GTX 1070/PCIe/SSE2
Mono: Logfile is: /home/carter/.local/share/godot/mono/mono_logs/2019_06_15 14.19.00 (19749).txt
ERROR: mono_log_callback: Mono: FATAL ERROR, ABORTING! Logfile: /home/carter/.local/share/godot/mono/mono_logs/2019_06_15 14.19.00 (19749).txt

   At: modules/mono/mono_gd/gd_mono_log.cpp:75.

=================================================================
        Native Crash Reporting
=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================
/proc/self/maps:
00400000-00780000 r--p 00000000 103:05 1180805                           /home/carter/code/godot/bin/godot.x11.opt.tools.64.mono
00780000-02dfd000 r-xp 00380000 103:05 1180805                           /home/carter/code/godot/bin/godot.x11.opt.tools.64.mono
02dfd000-0405f000 r--p 029fd000 103:05 1180805                           /home/carter/code/godot/bin/godot.x11.opt.tools.64.mono
0405f000-04127000 r--p 03c5e000 103:05 1180805                           /home/carter/code/godot/bin/godot.x11.opt.tools.64.mono
04127000-0413f000 rw-p 03d26000 103:05 1180805                           /home/carter/code/godot/bin/godot.x11.opt.tools.64.mono
0413f000-04157000 rw-p 00000000 00:00 0 
04394000-0835a000 rw-p 00000000 00:00 0                                  [heap]
40731000-408c1000 rwxp 00000000 00:00 0 
40be1000-40bf1000 rwxp 00000000 00:00 0 
40bfa000-40cac000 rw-p 00000000 00:00 0 
4108c000-4109c000 rwxp 00000000 00:00 0 
41316000-41326000 rwxp 00000000 00:00 0 
41837000-41839000 r-xs 00000000 00:2c 726867                             /tmp/.glEE5j7S (deleted)
41c28000-41c38000 rwxp 00000000 00:00 0 
7fc467fff000-7fc46c000000 rw-p 00000000 00:00 0 
7fc46c000000-7fc46c021000 rw-p 00000000 00:00 0 
7fc46c021000-7fc470000000 ---p 00000000 00:00 0 
7fc474000000-7fc474021000 rw-p 00000000 00:00 0 
7fc474021000-7fc478000000 ---p 00000000 00:00 0 
7fc478000000-7fc478021000 rw-p 00000000 00:00 0 
7fc478021000-7fc47c000000 ---p 00000000 00:00 0 
7fc47c000000-7fc47c021000 rw-p 00000000 00:00 0 
7fc47c021000-7fc480000000 ---p 00000000 00:00 0 
7fc4831ff000-7fc4833ff000 rw-s 00000000 00:06 18956                      /dev/nvidiactl
7fc4833ff000-7fc4837ff000 rw-s 00000000 00:06 18956                      /dev/nvidiactl

=================================================================
        Basic Fault Adddress Reporting
=================================================================
Memory around native instruction pointer (0x7fc4a700282f):0x7fc4a700281f  d2 4c 89 ce bf 02 00 00 00 b8 0e 00 00 00 0f 05  .L..............
0x7fc4a700282f  48 8b 8c 24 08 01 00 00 64 48 33 0c 25 28 00 00  H..$....dH3.%(..
0x7fc4a700283f  00 44 89 c0 75 19 48 81 c4 10 01 00 00 5b c3 66  .D..u.H......[.f
0x7fc4a700284f  90 48 8b 15 e9 75 18 00 f7 d8 64 89 02 eb ba 67  .H...u....d....g

=================================================================
        Native stacktrace:
=================================================================
        0x7fc4a75cd49a - /usr/lib/libmonosgen-2.0.so.1 : (null)
        0x7fc4a7562fce - /usr/lib/libmonosgen-2.0.so.1 : (null)
        0x7fc4a792f4d0 - /usr/lib/libpthread.so.0 : (null)
        0x7fc4a700282f - /usr/lib/libc.so.6 : gsignal
        0x7fc4a6fed672 - /usr/lib/libc.so.6 : abort
        0x2b63c16 - godot.x11.opt.tools.64.mono : (null)
        0x7fc4a77b9e2c - /usr/lib/libmonosgen-2.0.so.1 : (null)
        0x7fc4a77ba253 - /usr/lib/libmonosgen-2.0.so.1 : monoeg_g_logv
        0x7fc4a77ba310 - /usr/lib/libmonosgen-2.0.so.1 : monoeg_g_log
        0x7fc4a77b11a5 - /usr/lib/libmonosgen-2.0.so.1 : (null)
        0x7fc4a77b2697 - /usr/lib/libmonosgen-2.0.so.1 : (null)
        0x7fc4a77b2715 - /usr/lib/libmonosgen-2.0.so.1 : mono_threads_enter_gc_safe_region_unbalanced
        0x408bef0b - Unknown

=================================================================
        Telemetry Dumper:
=================================================================
Pkilling 0x7fc4a4263700 from 0x7fc4a5adbdc0
Pkilling 0x7fc49df58700 from 0x7fc4a5adbdc0
Entering thread summarizer pause from 0x7fc4a5adbdc0
Finished thread summarizer pause from 0x7fc4a5adbdc0.
debugger-agent: Unable to listen on 78

Waiting for dumping threads to resume

Debug info from gdb:

=================================================================
        External Debugger Dump:
=================================================================
[New LWP 19750]
[New LWP 19753]
[New LWP 19754]
[New LWP 19755]
[New LWP 19756]
[New LWP 19757]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
0x00007fc4a792ee52 in waitpid () from /usr/lib/libpthread.so.0
  Id   Target Id                                           Frame 
* 1    Thread 0x7fc4a5adbdc0 (LWP 19749) "godot.x11.opt.t" 0x00007fc4a792ee52 in waitpid () from /usr/lib/libpthread.so.0
  2    Thread 0x7fc4a83f8700 (LWP 19750) "godot.x11.opt.t" 0x00007fc4a792d506 in do_futex_wait.constprop () from /usr/lib/libpthread.so.0
  3    Thread 0x7fc4a4a0c700 (LWP 19753) "godot.x11.opt.t" 0x00007fc4a792d506 in do_futex_wait.constprop () from /usr/lib/libpthread.so.0
  4    Thread 0x7fc4a43c9700 (LWP 19754) "godot.x11.opt.t" 0x00007fc4a792e960 in nanosleep () from /usr/lib/libpthread.so.0
  5    Thread 0x7fc4a4388700 (LWP 19755) "godot.x11.opt.t" 0x00007fc4a7092908 in nanosleep () from /usr/lib/libc.so.6
  6    Thread 0x7fc49d7ff700 (LWP 19756) "SGen worker"     0x00007fc4a792abac in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
  7    Thread 0x7fc4a4263700 (LWP 19757) "Finalizer"       0x00007fc4a792d506 in do_futex_wait.constprop () from /usr/lib/libpthread.so.0

Thread 7 (Thread 0x7fc4a4263700 (LWP 19757)):
#0  0x00007fc4a792d506 in do_futex_wait.constprop () from /usr/lib/libpthread.so.0
#1  0x00007fc4a792d608 in __new_sem_wait_slow.constprop.0 () from /usr/lib/libpthread.so.0
#2  0x00007fc4a7742b0a in ?? () from /usr/lib/libmonosgen-2.0.so.1
#3  0x00007fc4a76ee93c in ?? () from /usr/lib/libmonosgen-2.0.so.1
#4  0x00007fc4a7924a92 in start_thread () from /usr/lib/libpthread.so.0
#5  0x00007fc4a70c5cd3 in clone () from /usr/lib/libc.so.6

Thread 6 (Thread 0x7fc49d7ff700 (LWP 19756)):
#0  0x00007fc4a792abac in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
#1  0x00007fc4a7794144 in ?? () from /usr/lib/libmonosgen-2.0.so.1
#2  0x00007fc4a7924a92 in start_thread () from /usr/lib/libpthread.so.0
#3  0x00007fc4a70c5cd3 in clone () from /usr/lib/libc.so.6

Thread 5 (Thread 0x7fc4a4388700 (LWP 19755)):
#0  0x00007fc4a7092908 in nanosleep () from /usr/lib/libc.so.6
#1  0x00007fc4a70be1b8 in usleep () from /usr/lib/libc.so.6
#2  0x0000000002cd8297 in JoypadLinux::monitor_joypads() ()
#3  0x0000000002534de5 in ThreadPosix::thread_callback(void*) ()
#4  0x00007fc4a7924a92 in start_thread () from /usr/lib/libpthread.so.0
#5  0x00007fc4a70c5cd3 in clone () from /usr/lib/libc.so.6

Thread 4 (Thread 0x7fc4a43c9700 (LWP 19754)):
#0  0x00007fc4a792e960 in nanosleep () from /usr/lib/libpthread.so.0
#1  0x0000000000bbd8eb in OS_Unix::delay_usec(unsigned int) const [clone .constprop.12479] ()
#2  0x0000000002597bf4 in AudioDriverPulseAudio::thread_func(void*) ()
#3  0x0000000002534de5 in ThreadPosix::thread_callback(void*) ()
#4  0x00007fc4a7924a92 in start_thread () from /usr/lib/libpthread.so.0
#5  0x00007fc4a70c5cd3 in clone () from /usr/lib/libc.so.6

Thread 3 (Thread 0x7fc4a4a0c700 (LWP 19753)):
#0  0x00007fc4a792d506 in do_futex_wait.constprop () from /usr/lib/libpthread.so.0
#1  0x00007fc4a792d608 in __new_sem_wait_slow.constprop.0 () from /usr/lib/libpthread.so.0
#2  0x0000000002482dbd in SemaphorePosix::wait() [clone .part.0] ()
#3  0x000000000120a2b3 in VisualServerScene::_gi_probe_bake_thread() ()
#4  0x0000000002534de5 in ThreadPosix::thread_callback(void*) ()
#5  0x00007fc4a7924a92 in start_thread () from /usr/lib/libpthread.so.0
#6  0x00007fc4a70c5cd3 in clone () from /usr/lib/libc.so.6

Thread 2 (Thread 0x7fc4a83f8700 (LWP 19750)):
#0  0x00007fc4a792d506 in do_futex_wait.constprop () from /usr/lib/libpthread.so.0
#1  0x00007fc4a792d608 in __new_sem_wait_slow.constprop.0 () from /usr/lib/libpthread.so.0
#2  0x0000000002482dbd in SemaphorePosix::wait() [clone .part.0] ()
#3  0x0000000000d10d84 in _IP_ResolverPrivate::_thread_function(void*) ()
#4  0x0000000002534de5 in ThreadPosix::thread_callback(void*) ()
#5  0x00007fc4a7924a92 in start_thread () from /usr/lib/libpthread.so.0
#6  0x00007fc4a70c5cd3 in clone () from /usr/lib/libc.so.6

Thread 1 (Thread 0x7fc4a5adbdc0 (LWP 19749)):
#0  0x00007fc4a792ee52 in waitpid () from /usr/lib/libpthread.so.0
#1  0x00007fc4a75cd71a in ?? () from /usr/lib/libmonosgen-2.0.so.1
#2  0x00007fc4a7562fce in ?? () from /usr/lib/libmonosgen-2.0.so.1
#3  <signal handler called>
#4  0x00007fc4a700282f in raise () from /usr/lib/libc.so.6
#5  0x00007fc4a6fed672 in abort () from /usr/lib/libc.so.6
#6  0x0000000002b63c16 in mono_log_callback(char const*, char const*, char const*, int, void*) ()
#7  0x00007fc4a77b9e2c in ?? () from /usr/lib/libmonosgen-2.0.so.1
#8  0x00007fc4a77ba253 in monoeg_g_logv () from /usr/lib/libmonosgen-2.0.so.1
#9  0x00007fc4a77ba310 in monoeg_g_log () from /usr/lib/libmonosgen-2.0.so.1
#10 0x00007fc4a77b11a5 in ?? () from /usr/lib/libmonosgen-2.0.so.1
#11 0x00007fc4a77b2697 in ?? () from /usr/lib/libmonosgen-2.0.so.1
#12 0x00007fc4a77b2715 in mono_threads_enter_gc_safe_region_unbalanced () from /usr/lib/libmonosgen-2.0.so.1
#13 0x00000000408bef0b in ?? ()
#14 0x00007fc49d8bfc70 in ?? ()
#15 0x00007fc49d8bfc20 in ?? ()
#16 0x0000000000000000 in ?? ()
[Inferior 1 (process 19749) detached]

=================================================================
        Managed Stacktrace:
=================================================================
          at <unknown> <0xffffffff>
          at Godot.GD:godot_icall_GD_print <0x000ba>
          at Godot.GD:Print <0x001af>
          at Root:DoSomething <0x00107>
          at <Module>:runtime_invoke_void__this___int <0x000db>
          at <unknown> <0xffffffff>
          at Godot.NativeCalls:godot_icall_2_552 <0x000f3>
          at Godot.Node:Rpc <0x000cb>
          at Root:_Input <0x00233>
          at <Module>:runtime_invoke_void__this___object <0x000d8>
=================================================================
fish: “godot.x11.opt.tools.64.mono” terminated by signal SIGABRT (Abort)

Steps to reproduce:

Minimal reproduction project: Repro_MonoCrash.zip

cart commented 5 years ago

Pulling in the mono master @neikeq

neikeq commented 5 years ago

Can you copy here the mono log as well?

cart commented 5 years ago

Sure thing!

Config attempting to parse: '/etc/mono/config'. (in domain Mono, info)
Config attempting to parse: '/home/carter/.mono/config'. (in domain Mono, info)
Image addref mscorlib[0x5e97830] (asmctx DEFAULT) -> /usr/lib/mono/4.5/mscorlib.dll[0x5d16320]: 3 (in domain Mono, info)
Prepared to set up assembly 'mscorlib' (/usr/lib/mono/4.5/mscorlib.dll) (in domain Mono, info)
AOT: module /usr/lib/mono/4.5/mscorlib.dll.so is unusable: compiled with unsupported SIMD extensions. (in domain Mono, info)
Assembly mscorlib[0x5e97830] added to domain GodotEngine.RootDomain, ref_count=1 (in domain Mono, info)
Assembly mscorlib[0x5e97830] added to domain GodotEngine.ToolsDomain, ref_count=2 (in domain Mono, info)
Image addref GodotSharpTools[0x5f1f930] (asmctx DEFAULT) -> /home/carter/code/godot/bin/GodotSharp/Tools/GodotSharpTools.dll[0x5f1def0]: 2 (in domain Mono, info)
Prepared to set up assembly 'GodotSharpTools' (/home/carter/code/godot/bin/GodotSharp/Tools/GodotSharpTools.dll) (in domain Mono, info)
Assembly GodotSharpTools[0x5f1f930] added to domain GodotEngine.ToolsDomain, ref_count=1 (in domain Mono, info)
Assembly mscorlib[0x5e97830] added to domain GodotEngine.ScriptsDomain, ref_count=3 (in domain Mono, info)
Image addref GodotSharp[0x6552a60] (asmctx DEFAULT) -> /home/carter/Repro_MonoCrash/.mono/assemblies/GodotSharp.dll[0x5f4c230]: 3 (in domain Mono, info)
Prepared to set up assembly 'GodotSharp' (/home/carter/Repro_MonoCrash/.mono/assemblies/GodotSharp.dll) (in domain Mono, info)
Assembly GodotSharp[0x6552a60] added to domain GodotEngine.ScriptsDomain, ref_count=1 (in domain Mono, info)
Loading reference 0 of /home/carter/Repro_MonoCrash/.mono/assemblies/GodotSharp.dll asmctx DEFAULT, looking for mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 (in domain Mono, info)
Config attempting to parse: ''. (in domain Mono, info)
Assembly Ref addref GodotSharp[0x6552a60] -> mscorlib[0x5e97830]: 4 (in domain Mono, info)
Loading reference 2 of /home/carter/Repro_MonoCrash/.mono/assemblies/GodotSharp.dll asmctx DEFAULT, looking for System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 (in domain Mono, info)
Image addref System[0x6570ae0] (asmctx DEFAULT) -> /usr/lib/mono/4.5/System.dll[0x656f9d0]: 2 (in domain Mono, info)
Prepared to set up assembly 'System' (/usr/lib/mono/4.5/System.dll) (in domain Mono, info)
Assembly System[0x6570ae0] added to domain GodotEngine.ScriptsDomain, ref_count=1 (in domain Mono, info)
Assembly Ref addref GodotSharp[0x6552a60] -> System[0x6570ae0]: 2 (in domain Mono, info)
Loading reference 0 of /usr/lib/mono/4.5/System.dll asmctx DEFAULT, looking for mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 (in domain Mono, info)
Assembly Ref addref System[0x6570ae0] -> mscorlib[0x5e97830]: 5 (in domain Mono, info)
Loading reference 2 of /usr/lib/mono/4.5/System.dll asmctx DEFAULT, looking for System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (in domain Mono, info)
Image addref System.Configuration[0x6604000] (asmctx DEFAULT) -> /usr/lib/mono/4.5/System.Configuration.dll[0x66038d0]: 2 (in domain Mono, info)
Prepared to set up assembly 'System.Configuration' (/usr/lib/mono/4.5/System.Configuration.dll) (in domain Mono, info)
Assembly System.Configuration[0x6604000] added to domain GodotEngine.ScriptsDomain, ref_count=1 (in domain Mono, info)
Assembly Ref addref System[0x6570ae0] -> System.Configuration[0x6604000]: 2 (in domain Mono, info)
Loading reference 0 of /usr/lib/mono/4.5/System.Configuration.dll asmctx DEFAULT, looking for mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 (in domain Mono, info)
Assembly Ref addref System.Configuration[0x6604000] -> mscorlib[0x5e97830]: 6 (in domain Mono, info)
Loading reference 2 of /usr/lib/mono/4.5/System.Configuration.dll asmctx DEFAULT, looking for System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 (in domain Mono, info)
Assembly Ref addref System.Configuration[0x6604000] -> System[0x6570ae0]: 3 (in domain Mono, info)
Loading reference 1 of /usr/lib/mono/4.5/System.Configuration.dll asmctx DEFAULT, looking for System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 (in domain Mono, info)
Image addref System.Xml[0x664e320] (asmctx DEFAULT) -> /usr/lib/mono/4.5/System.Xml.dll[0x664d110]: 2 (in domain Mono, info)
Prepared to set up assembly 'System.Xml' (/usr/lib/mono/4.5/System.Xml.dll) (in domain Mono, info)
Assembly System.Xml[0x664e320] added to domain GodotEngine.ScriptsDomain, ref_count=1 (in domain Mono, info)
Assembly Ref addref System.Configuration[0x6604000] -> System.Xml[0x664e320]: 2 (in domain Mono, info)
Loading reference 0 of /usr/lib/mono/4.5/System.Xml.dll asmctx DEFAULT, looking for mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 (in domain Mono, info)
Assembly Ref addref System.Xml[0x664e320] -> mscorlib[0x5e97830]: 7 (in domain Mono, info)
Loading reference 2 of /usr/lib/mono/4.5/System.Xml.dll asmctx DEFAULT, looking for System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 (in domain Mono, info)
Assembly Ref addref System.Xml[0x664e320] -> System[0x6570ae0]: 4 (in domain Mono, info)
Image addref Mono.Security[0x61a6020] (asmctx DEFAULT) -> /usr/lib/mono/4.5/Mono.Security.dll[0x613d4f0]: 2 (in domain Mono, info)
Prepared to set up assembly 'Mono.Security' (/usr/lib/mono/4.5/Mono.Security.dll) (in domain Mono, info)
Assembly Mono.Security[0x61a6020] added to domain GodotEngine.ScriptsDomain, ref_count=1 (in domain Mono, info)
Loading reference 0 of /usr/lib/mono/4.5/Mono.Security.dll asmctx DEFAULT, looking for mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 (in domain Mono, info)
Assembly Ref addref Mono.Security[0x61a6020] -> mscorlib[0x5e97830]: 8 (in domain Mono, info)
Loading reference 3 of /usr/lib/mono/4.5/System.dll asmctx DEFAULT, looking for System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 (in domain Mono, info)
Assembly Ref addref System[0x6570ae0] -> System.Xml[0x664e320]: 3 (in domain Mono, info)
Image addref GodotSharpEditor[0x6cdaaf0] (asmctx DEFAULT) -> /home/carter/Repro_MonoCrash/.mono/assemblies/GodotSharpEditor.dll[0x623a4d0]: 3 (in domain Mono, info)
Prepared to set up assembly 'GodotSharpEditor' (/home/carter/Repro_MonoCrash/.mono/assemblies/GodotSharpEditor.dll) (in domain Mono, info)
Assembly GodotSharpEditor[0x6cdaaf0] added to domain GodotEngine.ScriptsDomain, ref_count=1 (in domain Mono, info)
Loading reference 0 of /home/carter/Repro_MonoCrash/.mono/assemblies/GodotSharpEditor.dll asmctx DEFAULT, looking for mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 (in domain Mono, info)
Assembly Ref addref GodotSharpEditor[0x6cdaaf0] -> mscorlib[0x5e97830]: 9 (in domain Mono, info)
Image addref Repro_MonoCrash[0x6cd7e20] (asmctx DEFAULT) -> /home/carter/Repro_MonoCrash/.mono/temp/bin/Tools/Repro_MonoCrash.dll[0x6cd2980]: 3 (in domain Mono, info)
Prepared to set up assembly 'Repro_MonoCrash' (/home/carter/Repro_MonoCrash/.mono/temp/bin/Tools/Repro_MonoCrash.dll) (in domain Mono, info)
Assembly Repro_MonoCrash[0x6cd7e20] added to domain GodotEngine.ScriptsDomain, ref_count=1 (in domain Mono, info)
Loading reference 1 of /home/carter/Repro_MonoCrash/.mono/temp/bin/Tools/Repro_MonoCrash.dll asmctx DEFAULT, looking for GodotSharp, Version=1.0.7105.19899, Culture=neutral, PublicKeyToken=null (in domain Mono, info)
Assembly Ref addref Repro_MonoCrash[0x6cd7e20] -> GodotSharp[0x6552a60]: 2 (in domain Mono, info)
Loading reference 0 of /home/carter/Repro_MonoCrash/.mono/temp/bin/Tools/Repro_MonoCrash.dll asmctx DEFAULT, looking for mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 (in domain Mono, info)
Assembly Ref addref Repro_MonoCrash[0x6cd7e20] -> mscorlib[0x5e97830]: 10 (in domain Mono, info)
Loading reference 1 of /home/carter/Repro_MonoCrash/.mono/assemblies/GodotSharp.dll asmctx DEFAULT, looking for System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 (in domain Mono, info)
Image addref System.Core[0x7f453e0] (asmctx DEFAULT) -> /usr/lib/mono/4.5/System.Core.dll[0x7f44150]: 2 (in domain Mono, info)
Prepared to set up assembly 'System.Core' (/usr/lib/mono/4.5/System.Core.dll) (in domain Mono, info)
Assembly System.Core[0x7f453e0] added to domain GodotEngine.ScriptsDomain, ref_count=1 (in domain Mono, info)
Assembly Ref addref GodotSharp[0x6552a60] -> System.Core[0x7f453e0]: 2 (in domain Mono, info)
Loading reference 0 of /usr/lib/mono/4.5/System.Core.dll asmctx DEFAULT, looking for mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 (in domain Mono, info)
Assembly Ref addref System.Core[0x7f453e0] -> mscorlib[0x5e97830]: 11 (in domain Mono, info)
mono_threads_enter_gc_safe_region_unbalanced Cannot transition thread 0x7fc4a5adbdc0 from STATE_BLOCKING with DO_BLOCKING (in domain , error)
cart commented 5 years ago

I believe this is a more general problem. I am also hitting this when I run GetInstanceId from a "body_exited" signal handler.

Maybe the issue is godot_icall_XXXX functions fail when run in nested event handlers?

cart commented 5 years ago

ex:

          at <unknown> <0xffffffff>
          at Godot.NativeCalls:godot_icall_0_27 <0x000c2>
          at Godot.Object:GetInstanceId <0x000d3>
          at HighHat.Scene.Attacks.Attack:BodyExited <0x000bb>
          at HighHat.Scene.Nodes.ExtendedArea:BodyExitedInternal <0x000de>
          at <Module>:runtime_invoke_void__this___object <0x000d8>
          at <unknown> <0xffffffff>
          at Godot.NativeCalls:godot_icall_1_12 <0x000e8>
          at Godot.Area:SetMonitoring <0x000cf>
          at Godot.Area:set_Monitoring <0x0009b>
          at HighHat.Scene.Attacks.Attack:Remove <0x00097>
          at HighHat.Scene.Attacks.PunchMove:OnActivateEnd <0x000af>
          at HighHat.Actors.Players.MoveBehavior:Recover <0x000c3>
          at HighHat.Actors.Players.MoveBehavior:_PhysicsProcess <0x0061f>
          at <Module>:runtime_invoke_void__this___single <0x000dc>
cart commented 5 years ago

Any movement on this? I'm currently in a weird place where I can't publicly release my game on 3.1 due to bugs and I can't publicly release on master (soon to be 3.2) due to bugs.

Of course I assume full responsibility for building on preview software and I am nothing but thankful to everyone involved in building this awesome (free) product. That being said, making High Hat releasable on 3.2 is a high priority for me, so if none of the subject matter experts are looking into this I will need to become a subject matter expert and fix it myself. I would just appreciate knowing whether I should wait or start diving into the weeds.

santouits commented 5 years ago

I think the fix should be that for 3.2 and the next bugfix version of 3.1 to set mono to work without the hybrid suspend mode. If you search the repository they are still fixing issues with that, and also they added it by default only on linux and mac, this may be why I can't reproduce on windows some similar crashes I have. Somehow adding to the environment MONO_THREADS_SUSPEND=preemptive what do you say @neikeq ?

neikeq commented 5 years ago

I've been trying to see if I could find the source of the problem for the last two days without luck so as you say, we will have to hard-code it to use preemptive suspend mode as a workaround until we can get this fixed.

neikeq commented 5 years ago

We'll be forcing preemptive mode for now (#31784), so these crashes should not happen anymore.

Let's keep this issue open until we can get an actual fix.

cart commented 5 years ago

That worked! High Hat works with 3.2 now. Big thanks to @neikeq and @santouits for looking in to this.

KoBeWi commented 4 years ago

Can anyone still reproduce this bug in Godot 3.2.3 or any later release?

raulsntos commented 1 year ago

Moving to the 3.x milestone since we don't use Mono in 4.0.

@neikeq Not sure if we still want to look for a fix or if the temporary fix (https://github.com/godotengine/godot/pull/31784) is good enough and should close the issue.