Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xtro-sharpie.exe crashes with "Cannot transition thread 0x10c3ef5c0 from STATE_BLOCKING with DO_BLOCKING" #12724

Closed
akoeplinger opened this issue Feb 1, 2019 · 3 comments

Comments

@akoeplinger
Copy link
Member

@akoeplinger akoeplinger commented Feb 1, 2019

Steps to Reproduce

  1. Download and unzip attached bug.zip
  2. Run mono64 --debug xtro-sharpie.exe macosx10.14-x86_64.pch Xamarin.Mac.dll
  3. Observe crash.

It works fine with MONO_THREADS_SUSPEND=preemptive.

Current Behavior

$ mono64 --debug xtro-sharpie.exe macosx10.14-x86_64.pch Xamarin.Mac.dll
mono_thread_info_suspend_lock_with_info Cannot transition thread 0x10c3ef5c0 from STATE_BLOCKING with DO_BLOCKING

=================================================================
	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.
=================================================================

=================================================================
	Basic Fault Adddress Reporting
=================================================================
Memory around native instruction pointer (0x7fff7e99423e):0x7fff7e99422e  ff ff c3 90 90 90 b8 48 01 00 02 49 89 ca 0f 05  .......H...I....
0x7fff7e99423e  73 08 48 89 c7 e9 6f a1 ff ff c3 55 48 89 e5 41  s.H...o....UH..A
0x7fff7e99424e  57 41 56 41 55 41 54 53 48 81 ec 88 00 00 00 49  WAVAUATSH......I
0x7fff7e99425e  89 f4 48 8d 05 01 93 ca 32 48 8b 00 48 8d 9d 60  ..H.....2H..H..`

=================================================================
	Native stacktrace:
=================================================================
	0x105bb85c8 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : mono_dump_native_crash_info
	0x105b5ba85 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : mono_handle_native_crash
	0x7fff7ea3fb3d - /usr/lib/system/libsystem_platform.dylib : _sigtramp
	0x10c3bce78 - Unknown
	0x7fff7e8fd1c9 - /usr/lib/system/libsystem_c.dylib : abort
	0x105dab037 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : monoeg_assert_abort
	0x105d8d09f - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : mono_log_write_logfile
	0x105dab3be - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : monoeg_g_logv_nofree
	0x105dab472 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : monoeg_g_log
	0x105da1b3c - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : mono_threads_transition_do_blocking
	0x105da2e94 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : mono_threads_enter_gc_safe_region_unbalanced_with_info
	0x105d9fb54 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : mono_thread_info_suspend_lock_with_info
	0x105d3e33b - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : sgen_client_stop_world
	0x105d518a6 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : sgen_stop_world
	0x105d4e61d - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : sgen_perform_collection
	0x105d4e567 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : sgen_ensure_free_space
	0x105d43f5e - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : sgen_alloc_obj_nolock
	0x105d44444 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : sgen_alloc_obj
	0x105d401eb - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : mono_gc_alloc_obj
	0x1061bea4e - Unknown

=================================================================
	Telemetry Dumper:
=================================================================
Pkilling 0x700009849000 from 0x10c3ef5c0
Entering thread summarizer pause from 0x10c3ef5c0
Finished thread summarizer pause from 0x10c3ef5c0.

Waiting for dumping threads to resume
^C
Debug info from gdb:


=================================================================
	External Debugger Dump:
=================================================================
(lldb) command source -s 0 '/tmp/mono-gdb-commands.58273'
Executing commands in '/tmp/mono-gdb-commands.58273'.
(lldb) process attach --pid 58273
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/usr/local/Cellar/python@2/2.7.15_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 52, in <module>
    import weakref
  File "/usr/local/Cellar/python@2/2.7.15_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/weakref.py", line 14, in <module>
    from _weakref import (
ImportError: cannot import name _remove_dead_weakref
warning: (x86_64) /Library/Frameworks/Mono.framework/Versions/5.20.0/lib/mono/4.5/mscorlib.dll.dylib empty dSYM file detected, dSYM was created with an executable with no debug info.
Process 58273 stopped
* thread #1, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x00007fff7e9932d2 libsystem_kernel.dylib`__wait4 + 10
libsystem_kernel.dylib`__wait4:
->  0x7fff7e9932d2 <+10>: jae    0x7fff7e9932dc            ; <+20>
    0x7fff7e9932d4 <+12>: movq   %rax, %rdi
    0x7fff7e9932d7 <+15>: jmp    0x7fff7e98e381            ; cerror
    0x7fff7e9932dc <+20>: retq
Target 0: (mono64) stopped.

Executable module set to "/Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64".
Architecture set to: x86_64h-apple-macosx.
(lldb) thread list
Process 58273 stopped
* thread #1: tid = 0x54af85, 0x00007fff7e9932d2 libsystem_kernel.dylib`__wait4 + 10, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  thread #2: tid = 0x54af8a, 0x00007fff7e9917de libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'SGen worker'
  thread #3: tid = 0x54af8b, 0x00007fff7e990e76 libsystem_kernel.dylib`__psynch_mutexwait + 10, name = 'Finalizer'
  thread #4: tid = 0x54af8e, 0x00007fff7e98fb6a libsystem_kernel.dylib`__workq_kernreturn + 10
  thread #5: tid = 0x54af8f, 0x00007fff7e98fb6a libsystem_kernel.dylib`__workq_kernreturn + 10
(lldb) thread backtrace all
* thread #1, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x00007fff7e9932d2 libsystem_kernel.dylib`__wait4 + 10
    frame #1: 0x0000000105bb8820 mono64`mono_dump_native_crash_info at mini-posix.c:1116 [opt]
    frame #2: 0x0000000105bb8564 mono64`mono_dump_native_crash_info(signal=<unavailable>, ctx=<unavailable>, info=<unavailable>) at mini-posix.c:1152 [opt]
    frame #3: 0x0000000105b5ba85 mono64`mono_handle_native_crash(signal="SIGABRT", ctx=0x00007ffeea15cb40, info=0x00007ffeea15cad8) at mini-exceptions.c:3219 [opt]
    frame #4: 0x00007fff7ea3fb3d libsystem_platform.dylib`_sigtramp + 29
    frame #5: 0x00007fff7e99423f libsystem_kernel.dylib`__pthread_kill + 11
    frame #6: 0x00007fff7ea4ac1c libsystem_pthread.dylib`pthread_kill + 285
    frame #7: 0x00007fff7e8fd1c9 libsystem_c.dylib`abort + 127
    frame #8: 0x0000000105dab037 mono64`monoeg_assert_abort at goutput.c:57 [opt]
    frame #9: 0x0000000105d8d09f mono64`mono_log_write_logfile(log_domain=<unavailable>, level=<unavailable>, hdr=<unavailable>, message="mono_thread_info_suspend_lock_with_info Cannot transition thread 0x10c3ef5c0 from STATE_BLOCKING with DO_BLOCKING") at mono-log-common.c:135 [opt]
    frame #10: 0x0000000105dab3be mono64`monoeg_g_logv_nofree [inlined] monoeg_g_logstr(log_domain=0x0000000000000000, log_level=G_LOG_LEVEL_ERROR, msg=<unavailable>) at goutput.c:134 [opt]
    frame #11: 0x0000000105dab395 mono64`monoeg_g_logv_nofree(log_domain=0x0000000000000000, log_level=G_LOG_LEVEL_ERROR, format="%s Cannot transition thread %p from %s with DO_BLOCKING", args=<unavailable>) at goutput.c:149 [opt]
    frame #12: 0x0000000105dab472 mono64`monoeg_g_log [inlined] monoeg_g_logv(log_domain=<unavailable>, log_level=<unavailable>, format=<unavailable>, args=<unavailable>) at goutput.c:156 [opt]
    frame #13: 0x0000000105dab46d mono64`monoeg_g_log(log_domain=<unavailable>, log_level=<unavailable>, format=<unavailable>) at goutput.c:165 [opt]
    frame #14: 0x0000000105da1b3c mono64`mono_threads_transition_do_blocking(info=<unavailable>, func=<unavailable>) at mono-threads-state-machine.c:608 [opt]
    frame #15: 0x0000000105da2e94 mono64`mono_threads_enter_gc_safe_region_unbalanced_with_info(info=0x00007f9984800000, stackdata=<unavailable>) at mono-threads-coop.c:264 [opt]
    frame #16: 0x0000000105d9fb54 mono64`mono_thread_info_suspend_lock_with_info(info=0x00007f9984800000) at mono-threads.c:1390 [opt]
    frame #17: 0x0000000105d3e33b mono64`sgen_client_stop_world [inlined] acquire_gc_locks at sgen-stw.c:87 [opt]
    frame #18: 0x0000000105d3e2dc mono64`sgen_client_stop_world(generation=0, serial_collection=0) at sgen-stw.c:111 [opt]
    frame #19: 0x0000000105d518a6 mono64`sgen_stop_world(generation=0, serial_collection=0) at sgen-gc.c:3824 [opt]
    frame #20: 0x0000000105d4e61d mono64`sgen_perform_collection [inlined] sgen_perform_collection_inner at sgen-gc.c:2531 [opt]
    frame #21: 0x0000000105d4e5b5 mono64`sgen_perform_collection(requested_size=4096, generation_to_collect=0, reason="Nursery full", forced_serial=0, stw=1) at sgen-gc.c:2636 [opt]
    frame #22: 0x0000000105d4e567 mono64`sgen_ensure_free_space(size=4096, generation=<unavailable>) at sgen-gc.c:2510 [opt]
    frame #23: 0x0000000105d43f5e mono64`sgen_alloc_obj_nolock(vtable=0x00007f99858ac338, size=24) at sgen-alloc.c:257 [opt]
    frame #24: 0x0000000105d44444 mono64`sgen_alloc_obj(vtable=0x00007f99858ac338, size=24) at sgen-alloc.c:424 [opt]
    frame #25: 0x0000000105d401eb mono64`mono_gc_alloc_obj(vtable=<unavailable>, size=<unavailable>) at sgen-mono.c:914 [opt]
    frame #26: 0x00000001061bea4e
  thread #2, name = 'SGen worker'
    frame #0: 0x00007fff7e9917de libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007fff7ea4b593 libsystem_pthread.dylib`_pthread_cond_wait + 724
    frame #2: 0x0000000105d842fe mono64`thread_func [inlined] mono_os_cond_wait(mutex=<unavailable>) at mono-os-mutex.h:173 [opt]
    frame #3: 0x0000000105d842eb mono64`thread_func at sgen-thread-pool.c:165 [opt]
    frame #4: 0x0000000105d842dd mono64`thread_func(data=0x0000000000000000) at sgen-thread-pool.c:196 [opt]
    frame #5: 0x00007fff7ea48305 libsystem_pthread.dylib`_pthread_body + 126
    frame #6: 0x00007fff7ea4b26f libsystem_pthread.dylib`_pthread_start + 70
    frame #7: 0x00007fff7ea47415 libsystem_pthread.dylib`thread_start + 13
  thread #3, name = 'Finalizer'
    frame #0: 0x00007fff7e990e76 libsystem_kernel.dylib`__psynch_mutexwait + 10
    frame #1: 0x00007fff7ea48d6c libsystem_pthread.dylib`_pthread_mutex_firstfit_lock_wait + 96
    frame #2: 0x00007fff7ea464b7 libsystem_pthread.dylib`_pthread_mutex_firstfit_lock_slow + 226
    frame #3: 0x0000000105d4efe9 mono64`sgen_gc_lock [inlined] mono_os_mutex_lock at mono-os-mutex.h:99 [opt]
    frame #4: 0x0000000105d4efdd mono64`sgen_gc_lock at mono-coop-mutex.h:56 [opt]
    frame #5: 0x0000000105d4efa4 mono64`sgen_gc_lock at sgen-gc.c:3766 [opt]
    frame #6: 0x0000000105d4265d mono64`mono_gc_skip_thread_changing(skip=0) at sgen-mono.c:2086 [opt]
    frame #7: 0x0000000105d9e8f0 mono64`mono_thread_info_set_flags(flags=MONO_THREAD_INFO_FLAGS_NONE) at mono-threads.c:792 [opt]
    frame #8: 0x0000000105d31b0b mono64`finalizer_thread(unused=<unavailable>) at gc.c:927 [opt]
    frame #9: 0x0000000105cdcd83 mono64`start_wrapper [inlined] start_wrapper_internal at threads.c:1175 [opt]
    frame #10: 0x0000000105cdccf3 mono64`start_wrapper(data=0x00007f9983418670) at threads.c:1235 [opt]
    frame #11: 0x00007fff7ea48305 libsystem_pthread.dylib`_pthread_body + 126
    frame #12: 0x00007fff7ea4b26f libsystem_pthread.dylib`_pthread_start + 70
    frame #13: 0x00007fff7ea47415 libsystem_pthread.dylib`thread_start + 13
  thread #4
    frame #0: 0x00007fff7e98fb6a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fff7ea47630 libsystem_pthread.dylib`_pthread_wqthread + 446
    frame #2: 0x00007fff7ea47405 libsystem_pthread.dylib`start_wqthread + 13
  thread #5
    frame #0: 0x00007fff7ea473f8 libsystem_pthread.dylib`start_wqthread
(lldb) detach
Process 58273 detached
(lldb) quit

=================================================================
	Managed Stacktrace:
=================================================================
	  at <unknown> <0xffffffff>
	  at System.Object:__icall_wrapper_mono_gc_alloc_obj <0x0007d>
	  at System.Object:AllocSmall <0x0011a>
	  at <Module>:runtime_invoke_intptr__this__ <0x000ca>
	  at <unknown> <0xffffffff>
	  at Clang.Ast.Decl:GetTranslationUnitDecl <0x000b0>
	  at Clang.Ast.Decl:get_TranslationUnit <0x00042>
	  at <>c:<Decls>b__1_0 <0x00072>
	  at WhereEnumerableIterator`1:MoveNext <0x0014d>
	  at Clang.Ast.DeclContextImpl:Accept <0x000da>
	  at Clang.Ast.ObjCInterfaceDecl:Accept <0x0005a>
	  at Clang.Ast.DeclContextImpl:Accept <0x000c3>
	  at Clang.Ast.TranslationUnitDecl:Accept <0x0005a>
	  at <>c__DisplayClass1_0:<Execute>b__0 <0x00047>
	  at System.Action`1:invoke_void_T <0x00119>
	  at Clang.Ast.AstReader:HandleTranslationUnit <0x0004f>
	  at Clang.Ast.AstReader:HandleAstUnit <0x0010f>
	  at <Module>:runtime_invoke_void__this___intptr_intptr <0x000bd>
	  at <unknown> <0xffffffff>
	  at Clang.Ast.AstReader:LoadInternal <0x000b3>
	  at Clang.Ast.AstReader:Load <0x00082>
	  at Extrospection.Runner:Execute <0x00fb2>
	  at Extrospection.MainClass:Main <0x00202>
	  at <Module>:runtime_invoke_int_object <0x000a8>
=================================================================
Abort trap: 6
alexander:~/Desktop/bug$ rm *.raw
alexander:~/Desktop/bug$ rm *.unclassified
alexander:~/Desktop/bug$
alexander:~/Desktop/bug$ otool -L /Users/alexander/Desktop/bug/libclang-mono.dylib
/Users/alexander/Desktop/bug/libclang-mono.dylib:
	@executable_path/libclang-mono.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0)
	/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.8)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 307.5.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.50.2)
alexander:~/Desktop/bug$
alexander:~/Desktop/bug$
alexander:~/Desktop/bug$
alexander:~/Desktop/bug$
alexander:~/Desktop/bug$ mono64 --debug xtro-sharpie.exe macosx10.14-x86_64.pch Xamarin.Mac.dll
mono_thread_info_suspend_lock_with_info Cannot transition thread 0x1186d45c0 from STATE_BLOCKING with DO_BLOCKING

=================================================================
	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.
=================================================================

=================================================================
	Basic Fault Adddress Reporting
=================================================================
Memory around native instruction pointer (0x7fff7e99423e):0x7fff7e99422e  ff ff c3 90 90 90 b8 48 01 00 02 49 89 ca 0f 05  .......H...I....
0x7fff7e99423e  73 08 48 89 c7 e9 6f a1 ff ff c3 55 48 89 e5 41  s.H...o....UH..A
0x7fff7e99424e  57 41 56 41 55 41 54 53 48 81 ec 88 00 00 00 49  WAVAUATSH......I
0x7fff7e99425e  89 f4 48 8d 05 01 93 ca 32 48 8b 00 48 8d 9d 60  ..H.....2H..H..`

=================================================================
	Native stacktrace:
=================================================================
	0x108b9b5c8 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : mono_dump_native_crash_info
	0x108b3ea85 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : mono_handle_native_crash
	0x7fff7ea3fb3d - /usr/lib/system/libsystem_platform.dylib : _sigtramp
	0x1186a1e78 - Unknown
	0x7fff7e8fd1c9 - /usr/lib/system/libsystem_c.dylib : abort
	0x108d8e037 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : monoeg_assert_abort
	0x108d7009f - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : mono_log_write_logfile
	0x108d8e3be - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : monoeg_g_logv_nofree
	0x108d8e472 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : monoeg_g_log
	0x108d84b3c - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : mono_threads_transition_do_blocking
	0x108d85e94 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : mono_threads_enter_gc_safe_region_unbalanced_with_info
	0x108d82b54 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : mono_thread_info_suspend_lock_with_info
	0x108d2133b - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : sgen_client_stop_world
	0x108d348a6 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : sgen_stop_world
	0x108d3161d - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : sgen_perform_collection
	0x108d31567 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : sgen_ensure_free_space
	0x108d26f5e - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : sgen_alloc_obj_nolock
	0x108d27444 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : sgen_alloc_obj
	0x108d231eb - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64 : mono_gc_alloc_obj
	0x1091a2a4e - Unknown

=================================================================
	Telemetry Dumper:
=================================================================
Pkilling 0x70000f13f000 from 0x1186d45c0
Entering thread summarizer pause from 0x1186d45c0
Finished thread summarizer pause from 0x1186d45c0.

Waiting for dumping threads to resume

Debug info from gdb:


=================================================================
	External Debugger Dump:
=================================================================
(lldb) command source -s 0 '/tmp/mono-gdb-commands.58316'
Executing commands in '/tmp/mono-gdb-commands.58316'.
(lldb) process attach --pid 58316
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/usr/local/Cellar/python@2/2.7.15_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 52, in <module>
    import weakref
  File "/usr/local/Cellar/python@2/2.7.15_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/weakref.py", line 14, in <module>
    from _weakref import (
ImportError: cannot import name _remove_dead_weakref
warning: (x86_64) /Library/Frameworks/Mono.framework/Versions/5.20.0/lib/mono/4.5/mscorlib.dll.dylib empty dSYM file detected, dSYM was created with an executable with no debug info.
Process 58316 stopped
* thread #1, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x00007fff7e9932d2 libsystem_kernel.dylib`__wait4 + 10
libsystem_kernel.dylib`__wait4:
->  0x7fff7e9932d2 <+10>: jae    0x7fff7e9932dc            ; <+20>
    0x7fff7e9932d4 <+12>: movq   %rax, %rdi
    0x7fff7e9932d7 <+15>: jmp    0x7fff7e98e381            ; cerror
    0x7fff7e9932dc <+20>: retq
Target 0: (mono64) stopped.

Executable module set to "/Library/Frameworks/Mono.framework/Versions/Current/Commands/mono64".
Architecture set to: x86_64h-apple-macosx.
(lldb) thread list
Process 58316 stopped
* thread #1: tid = 0x54b383, 0x00007fff7e9932d2 libsystem_kernel.dylib`__wait4 + 10, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  thread #2: tid = 0x54b387, 0x00007fff7e9917de libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'SGen worker'
  thread #3: tid = 0x54b388, 0x00007fff7e990e76 libsystem_kernel.dylib`__psynch_mutexwait + 10, name = 'Finalizer'
  thread #4: tid = 0x54b38a, 0x00007fff7e98fb6a libsystem_kernel.dylib`__workq_kernreturn + 10
  thread #5: tid = 0x54b38c, 0x00007fff7e98fb6a libsystem_kernel.dylib`__workq_kernreturn + 10
(lldb) thread backtrace all
* thread #1, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x00007fff7e9932d2 libsystem_kernel.dylib`__wait4 + 10
    frame #1: 0x0000000108b9b820 mono64`mono_dump_native_crash_info at mini-posix.c:1116 [opt]
    frame #2: 0x0000000108b9b564 mono64`mono_dump_native_crash_info(signal=<unavailable>, ctx=<unavailable>, info=<unavailable>) at mini-posix.c:1152 [opt]
    frame #3: 0x0000000108b3ea85 mono64`mono_handle_native_crash(signal="SIGABRT", ctx=0x00007ffee7179b40, info=0x00007ffee7179ad8) at mini-exceptions.c:3219 [opt]
    frame #4: 0x00007fff7ea3fb3d libsystem_platform.dylib`_sigtramp + 29
    frame #5: 0x00007fff7e99423f libsystem_kernel.dylib`__pthread_kill + 11
    frame #6: 0x00007fff7ea4ac1c libsystem_pthread.dylib`pthread_kill + 285
    frame #7: 0x00007fff7e8fd1c9 libsystem_c.dylib`abort + 127
    frame #8: 0x0000000108d8e037 mono64`monoeg_assert_abort at goutput.c:57 [opt]
    frame #9: 0x0000000108d7009f mono64`mono_log_write_logfile(log_domain=<unavailable>, level=<unavailable>, hdr=<unavailable>, message="mono_thread_info_suspend_lock_with_info Cannot transition thread 0x1186d45c0 from STATE_BLOCKING with DO_BLOCKING") at mono-log-common.c:135 [opt]
    frame #10: 0x0000000108d8e3be mono64`monoeg_g_logv_nofree [inlined] monoeg_g_logstr(log_domain=0x0000000000000000, log_level=G_LOG_LEVEL_ERROR, msg=<unavailable>) at goutput.c:134 [opt]
    frame #11: 0x0000000108d8e395 mono64`monoeg_g_logv_nofree(log_domain=0x0000000000000000, log_level=G_LOG_LEVEL_ERROR, format="%s Cannot transition thread %p from %s with DO_BLOCKING", args=<unavailable>) at goutput.c:149 [opt]
    frame #12: 0x0000000108d8e472 mono64`monoeg_g_log [inlined] monoeg_g_logv(log_domain=<unavailable>, log_level=<unavailable>, format=<unavailable>, args=<unavailable>) at goutput.c:156 [opt]
    frame #13: 0x0000000108d8e46d mono64`monoeg_g_log(log_domain=<unavailable>, log_level=<unavailable>, format=<unavailable>) at goutput.c:165 [opt]
    frame #14: 0x0000000108d84b3c mono64`mono_threads_transition_do_blocking(info=<unavailable>, func=<unavailable>) at mono-threads-state-machine.c:608 [opt]
    frame #15: 0x0000000108d85e94 mono64`mono_threads_enter_gc_safe_region_unbalanced_with_info(info=0x00007f98de800000, stackdata=<unavailable>) at mono-threads-coop.c:264 [opt]
    frame #16: 0x0000000108d82b54 mono64`mono_thread_info_suspend_lock_with_info(info=0x00007f98de800000) at mono-threads.c:1390 [opt]
    frame #17: 0x0000000108d2133b mono64`sgen_client_stop_world [inlined] acquire_gc_locks at sgen-stw.c:87 [opt]
    frame #18: 0x0000000108d212dc mono64`sgen_client_stop_world(generation=0, serial_collection=0) at sgen-stw.c:111 [opt]
    frame #19: 0x0000000108d348a6 mono64`sgen_stop_world(generation=0, serial_collection=0) at sgen-gc.c:3824 [opt]
    frame #20: 0x0000000108d3161d mono64`sgen_perform_collection [inlined] sgen_perform_collection_inner at sgen-gc.c:2531 [opt]
    frame #21: 0x0000000108d315b5 mono64`sgen_perform_collection(requested_size=4096, generation_to_collect=0, reason="Nursery full", forced_serial=0, stw=1) at sgen-gc.c:2636 [opt]
    frame #22: 0x0000000108d31567 mono64`sgen_ensure_free_space(size=4096, generation=<unavailable>) at sgen-gc.c:2510 [opt]
    frame #23: 0x0000000108d26f5e mono64`sgen_alloc_obj_nolock(vtable=0x00007f98dd8ee538, size=24) at sgen-alloc.c:257 [opt]
    frame #24: 0x0000000108d27444 mono64`sgen_alloc_obj(vtable=0x00007f98dd8ee538, size=24) at sgen-alloc.c:424 [opt]
    frame #25: 0x0000000108d231eb mono64`mono_gc_alloc_obj(vtable=<unavailable>, size=<unavailable>) at sgen-mono.c:914 [opt]
    frame #26: 0x00000001091a2a4e
  thread #2, name = 'SGen worker'
    frame #0: 0x00007fff7e9917de libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007fff7ea4b593 libsystem_pthread.dylib`_pthread_cond_wait + 724
    frame #2: 0x0000000108d672fe mono64`thread_func [inlined] mono_os_cond_wait(mutex=<unavailable>) at mono-os-mutex.h:173 [opt]
    frame #3: 0x0000000108d672eb mono64`thread_func at sgen-thread-pool.c:165 [opt]
    frame #4: 0x0000000108d672dd mono64`thread_func(data=0x0000000000000000) at sgen-thread-pool.c:196 [opt]
    frame #5: 0x00007fff7ea48305 libsystem_pthread.dylib`_pthread_body + 126
    frame #6: 0x00007fff7ea4b26f libsystem_pthread.dylib`_pthread_start + 70
    frame #7: 0x00007fff7ea47415 libsystem_pthread.dylib`thread_start + 13
  thread #3, name = 'Finalizer'
    frame #0: 0x00007fff7e990e76 libsystem_kernel.dylib`__psynch_mutexwait + 10
    frame #1: 0x00007fff7ea48d6c libsystem_pthread.dylib`_pthread_mutex_firstfit_lock_wait + 96
    frame #2: 0x00007fff7ea464b7 libsystem_pthread.dylib`_pthread_mutex_firstfit_lock_slow + 226
    frame #3: 0x0000000108d31fe9 mono64`sgen_gc_lock [inlined] mono_os_mutex_lock at mono-os-mutex.h:99 [opt]
    frame #4: 0x0000000108d31fdd mono64`sgen_gc_lock at mono-coop-mutex.h:56 [opt]
    frame #5: 0x0000000108d31fa4 mono64`sgen_gc_lock at sgen-gc.c:3766 [opt]
    frame #6: 0x0000000108d2565d mono64`mono_gc_skip_thread_changing(skip=0) at sgen-mono.c:2086 [opt]
    frame #7: 0x0000000108d818f0 mono64`mono_thread_info_set_flags(flags=MONO_THREAD_INFO_FLAGS_NONE) at mono-threads.c:792 [opt]
    frame #8: 0x0000000108d14b0b mono64`finalizer_thread(unused=<unavailable>) at gc.c:927 [opt]
    frame #9: 0x0000000108cbfd83 mono64`start_wrapper [inlined] start_wrapper_internal at threads.c:1175 [opt]
    frame #10: 0x0000000108cbfcf3 mono64`start_wrapper(data=0x00007f98de110030) at threads.c:1235 [opt]
    frame #11: 0x00007fff7ea48305 libsystem_pthread.dylib`_pthread_body + 126
    frame #12: 0x00007fff7ea4b26f libsystem_pthread.dylib`_pthread_start + 70
    frame #13: 0x00007fff7ea47415 libsystem_pthread.dylib`thread_start + 13
  thread #4
    frame #0: 0x00007fff7e98fb6a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fff7ea47630 libsystem_pthread.dylib`_pthread_wqthread + 446
    frame #2: 0x00007fff7ea47405 libsystem_pthread.dylib`start_wqthread + 13
  thread #5
    frame #0: 0x00007fff7ea473f8 libsystem_pthread.dylib`start_wqthread
(lldb) detach
Process 58316 detached
(lldb) quit

=================================================================
	Managed Stacktrace:
=================================================================
	  at <unknown> <0xffffffff>
	  at System.Object:__icall_wrapper_mono_gc_alloc_obj <0x0007d>
	  at System.Object:AllocSmall <0x0011a>
	  at <Module>:runtime_invoke_intptr__this__ <0x000ca>
	  at <unknown> <0xffffffff>
	  at Clang.Ast.Decl:GetTranslationUnitDecl <0x000b0>
	  at Clang.Ast.Decl:get_TranslationUnit <0x00042>
	  at <>c:<Decls>b__1_0 <0x00072>
	  at WhereEnumerableIterator`1:MoveNext <0x0014d>
	  at Clang.Ast.DeclContextImpl:Accept <0x000da>
	  at Clang.Ast.ObjCInterfaceDecl:Accept <0x0005a>
	  at Clang.Ast.DeclContextImpl:Accept <0x000c3>
	  at Clang.Ast.TranslationUnitDecl:Accept <0x0005a>
	  at <>c__DisplayClass1_0:<Execute>b__0 <0x00047>
	  at System.Action`1:invoke_void_T <0x00119>
	  at Clang.Ast.AstReader:HandleTranslationUnit <0x0004f>
	  at Clang.Ast.AstReader:HandleAstUnit <0x0010f>
	  at <Module>:runtime_invoke_void__this___intptr_intptr <0x000bd>
	  at <unknown> <0xffffffff>
	  at Clang.Ast.AstReader:LoadInternal <0x000b3>
	  at Clang.Ast.AstReader:Load <0x00082>
	  at Extrospection.Runner:Execute <0x00fb2>
	  at Extrospection.MainClass:Main <0x00202>
	  at <Module>:runtime_invoke_int_object <0x000a8>
=================================================================
Abort trap: 6

Expected Behavior

No crash.

On which platforms did you notice this

[ X ] macOS
[ ] Linux
[ ] Windows

Version Used:

Mono JIT compiler version 5.20.0.172 (2018-10/15fb740a03d Thu Jan 31 18:50:21 PST 2019)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug
	Interpreter:   yes
	LLVM:          yes(600)
	Suspend:       hybrid
	GC:            sgen (concurrent by default)
@akoeplinger akoeplinger added this to the 2018-10 (5.20.xx) milestone Feb 1, 2019
akoeplinger added a commit to xamarin/xamarin-macios that referenced this issue Feb 1, 2019
@akoeplinger

This comment has been minimized.

Copy link
Member Author

@akoeplinger akoeplinger commented Feb 1, 2019

@lambdageek

This comment has been minimized.

Copy link
Member

@lambdageek lambdageek commented Feb 1, 2019

The repro includes a native library that makes calls back into mono - specifically mono_property_get_value which is an API call that didn't have thread state transitions - so the thread state gets out of sync with reality.

PR with a fix shortly...

lambdageek added a commit to lambdageek/mono that referenced this issue Feb 1, 2019
It's external only, so it should switch from GC Safe to GC Unsafe when called.

Addresses crash in mono#12724
lambdageek added a commit to lambdageek/mono that referenced this issue Feb 1, 2019
It's external only, so it should switch from GC Safe to GC Unsafe when called.

Addresses crash in mono#12724
monojenkins added a commit to monojenkins/mono that referenced this issue Feb 1, 2019
It's external only, so it should switch from GC Safe to GC Unsafe when called.

Addresses crash in mono#12724
lambdageek added a commit to lambdageek/mono that referenced this issue Feb 1, 2019
It's external only, so it should switch from GC Safe to GC Unsafe when called.

Addresses crash in mono#12724
luhenry added a commit that referenced this issue Feb 2, 2019
…ctions (#12735)

* [runtime] Switch to GC Unsafe in mono_property_get_value

It's external only, so it should switch from GC Safe to GC Unsafe when called.

Addresses crash in #12724

* [runtime] Make mono_image_loaded external only

Also mono_image_loaded_full

Runtime should use mono_image_loaded_internal

* [runtime] Make mono_get_exception_argument_null external only
akoeplinger added a commit that referenced this issue Feb 4, 2019
…ctions (#12736)

* [runtime] Switch to GC Unsafe in mono_property_get_value

It's external only, so it should switch from GC Safe to GC Unsafe when called.

Addresses crash in #12724

* [runtime] Make mono_image_loaded external only

Also mono_image_loaded_full

Runtime should use mono_image_loaded_internal

* [runtime] Make mono_get_exception_argument_null external only
akoeplinger added a commit that referenced this issue Feb 4, 2019
…12738)

* [runtime] Switch to GC Unsafe in mono_property_get_value

It's external only, so it should switch from GC Safe to GC Unsafe when called.

Addresses crash in #12724

* [runtime] Make mono_image_loaded external only

Also mono_image_loaded_full

Runtime should use mono_image_loaded_internal

* [runtime] Make mono_get_exception_argument_null external only
@akoeplinger

This comment has been minimized.

Copy link
Member Author

@akoeplinger akoeplinger commented Feb 4, 2019

This was fixed by the PR, thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.