Bug 41833

Summary: [SGEN?] XS crashed. error: * Assertion at gc.c:867, condition `finalizer_thread_exited' not met
Product: [Mono] Runtime Reporter: Stephen Shaw <sshaw>
Component: GCAssignee: Zoltan Varga <vargaz>
Status: VERIFIED NOT_REPRODUCIBLE    
Severity: normal CC: alexrp, asimk, bernhard.urban, mono-bugs+mono, mono-bugs+runtime, shrutis, vargaz
Priority: Normal    
Version: 4.4.0 (C7)   
Target Milestone: 4.6.0 (C8)   
Hardware: Macintosh   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:

Description Stephen Shaw 2016-06-14 23:02:04 UTC
Stacktrace:


Native stacktrace:

	0   libmonosgen-2.0.dylib               0x00000001017cd3aa mono_handle_native_sigsegv + 282
	1   libsystem_platform.dylib            0x00007fff95a9e52a _sigtramp + 26
	2   ???                                 0x00007fff6c0a8552 0x0 + 140735006016850
	3   libsystem_c.dylib                   0x00007fff9bf9d6e7 abort + 129
	4   libxammac.dylib                     0x000000010bfd7b86 _ZL12log_callbackPKcS0_S0_iPv + 70
	5   libmonosgen-2.0.dylib               0x00000001019784e0 monoeg_assertion_message + 192
	6   libmonosgen-2.0.dylib               0x00000001018e1af2 mono_gc_cleanup + 930
	7   libmonosgen-2.0.dylib               0x00000001018d9c7e mono_runtime_cleanup + 14
	8   libmonosgen-2.0.dylib               0x0000000101724b21 mini_cleanup + 721
	9   libmonosgen-2.0.dylib               0x0000000101798a9f mono_main + 7119
	10  XamarinStudio                       0x00000001014ad820 main + 2560
	11  libdyld.dylib                       0x00007fff89def5ad start + 1

Debug info from gdb:

(lldb) command source -s 0 '/tmp/mono-gdb-commands.cvRgkx'
Executing commands in '/tmp/mono-gdb-commands.cvRgkx'.
(lldb) process attach --pid 20161
Process 20161 stopped
* thread #1: tid = 0x2f53ea, 0x00007fff952cd582 libsystem_kernel.dylib`__wait4 + 10, name = 'tid_1613', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x00007fff952cd582 libsystem_kernel.dylib`__wait4 + 10
libsystem_kernel.dylib`__wait4:
->  0x7fff952cd582 <+10>: jae    0x7fff952cd58c            ; <+20>
    0x7fff952cd584 <+12>: movq   %rax, %rdi
    0x7fff952cd587 <+15>: jmp    0x7fff952c77f2            ; cerror
    0x7fff952cd58c <+20>: retq   

Executable module set to "/Applications/Xamarin Studio.app/Contents/MacOS/XamarinStudio".
Architecture set to: x86_64h-apple-macosx.
(lldb) thread list
Process 20161 stopped
* thread #1: tid = 0x2f53ea, 0x00007fff952cd582 libsystem_kernel.dylib`__wait4 + 10, name = 'tid_1613', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  thread #2: tid = 0x2f53f4, 0x00007fff952ccdb6 libsystem_kernel.dylib`__psynch_cvwait + 10
  thread #3: tid = 0x2f53f7, 0x00007fff952cdefa libsystem_kernel.dylib`kevent_qos + 10, queue = 'com.apple.libdispatch-manager'
  thread #4: tid = 0x2f579e, 0x00007fff952cd07a libsystem_kernel.dylib`__select + 10, name = 'com.apple.CFSocket.private'
  thread #5: tid = 0x2f57ab, 0x00007fff952c6f72 libsystem_kernel.dylib`mach_msg_trap + 10, name = 'com.apple.NSEventThread'
  thread #6: tid = 0x2f57c8, 0x00007fff952ccdb6 libsystem_kernel.dylib`__psynch_cvwait + 10
(lldb) thread backtrace all
* thread #1: tid = 0x2f53ea, 0x00007fff952cd582 libsystem_kernel.dylib`__wait4 + 10, name = 'tid_1613', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x00007fff952cd582 libsystem_kernel.dylib`__wait4 + 10
    frame #1: 0x00000001017cd441 libmonosgen-2.0.dylib`mono_handle_native_sigsegv(signal=<unavailable>, ctx=<unavailable>, info=<unavailable>) + 433 at mini-exceptions.c:2348 [opt]
    frame #2: 0x00007fff95a9e52a libsystem_platform.dylib`_sigtramp + 26
    frame #3: 0x00007fff952ccf07 libsystem_kernel.dylib`__pthread_kill + 11
    frame #4: 0x00007fff8c9f34ec libsystem_pthread.dylib`pthread_kill + 90
    frame #5: 0x00007fff9bf9d6e7 libsystem_c.dylib`abort + 129
    frame #6: 0x000000010bfd7b86 libxammac.dylib`log_callback(char const*, char const*, char const*, int, void*) + 70
    frame #7: 0x00000001019784e0 libmonosgen-2.0.dylib`monoeg_assertion_message [inlined] monoeg_g_logv(log_domain=<unavailable>, log_level=G_LOG_LEVEL_ERROR) + 68 at goutput.c:113 [opt]
    frame #8: 0x000000010197849c libmonosgen-2.0.dylib`monoeg_assertion_message(format=<unavailable>) + 124 at goutput.c:133 [opt]
    frame #9: 0x00000001018e1af2 libmonosgen-2.0.dylib`mono_gc_cleanup [inlined] mono_os_sem_post + 930 at mono-os-semaphore.h:136 [opt]
    frame #10: 0x00000001018e1ae7 libmonosgen-2.0.dylib`mono_gc_cleanup [inlined] mono_coop_sem_post at mono-coop-semaphore.h:64 [opt]
    frame #11: 0x00000001018e1ae7 libmonosgen-2.0.dylib`mono_gc_cleanup [inlined] mono_gc_finalize_notify at gc.c:623 [opt]
    frame #12: 0x00000001018e1ae7 libmonosgen-2.0.dylib`mono_gc_cleanup + 919 at gc.c:818 [opt]
    frame #13: 0x00000001018d9c7e libmonosgen-2.0.dylib`mono_runtime_cleanup(domain=<unavailable>) + 14 at appdomain.c:356 [opt]
    frame #14: 0x0000000101724b21 libmonosgen-2.0.dylib`mini_cleanup(domain=0x00007f9462603840) + 721 at mini-runtime.c:4017 [opt]
    frame #15: 0x0000000101798a9f libmonosgen-2.0.dylib`mono_main(argc=<unavailable>, argv=<unavailable>) + 7119 at driver.g.c:2166 [opt]
    frame #16: 0x00000001014ad820 XamarinStudio`main + 2560
    frame #17: 0x00007fff89def5ad libdyld.dylib`start + 1
    frame #18: 0x00007fff89def5ad libdyld.dylib`start + 1

  thread #2: tid = 0x2f53f4, 0x00007fff952ccdb6 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #0: 0x00007fff952ccdb6 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007fff8c9f1728 libsystem_pthread.dylib`_pthread_cond_wait + 767
    frame #2: 0x00000001019432ed libmonosgen-2.0.dylib`thread_func [inlined] mono_os_cond_wait(mutex=0x0000000101aaa0a0) + 15 at mono-os-mutex.h:105 [opt]
    frame #3: 0x00000001019432de libmonosgen-2.0.dylib`thread_func(thread_data=0x0000000000000000) + 462 at sgen-thread-pool.c:118 [opt]
    frame #4: 0x00007fff8c9f099d libsystem_pthread.dylib`_pthread_body + 131
    frame #5: 0x00007fff8c9f091a libsystem_pthread.dylib`_pthread_start + 168
    frame #6: 0x00007fff8c9ee351 libsystem_pthread.dylib`thread_start + 13

  thread #3: tid = 0x2f53f7, 0x00007fff952cdefa libsystem_kernel.dylib`kevent_qos + 10, queue = 'com.apple.libdispatch-manager'
    frame #0: 0x00007fff952cdefa libsystem_kernel.dylib`kevent_qos + 10
    frame #1: 0x00007fff93a06165 libdispatch.dylib`_dispatch_mgr_invoke + 216
    frame #2: 0x00007fff93a05dcd libdispatch.dylib`_dispatch_mgr_thread + 52

  thread #4: tid = 0x2f579e, 0x00007fff952cd07a libsystem_kernel.dylib`__select + 10, name = 'com.apple.CFSocket.private'
    frame #0: 0x00007fff952cd07a libsystem_kernel.dylib`__select + 10
    frame #1: 0x00007fff9f9124fa CoreFoundation`__CFSocketManager + 762
    frame #2: 0x00007fff8c9f099d libsystem_pthread.dylib`_pthread_body + 131
    frame #3: 0x00007fff8c9f091a libsystem_pthread.dylib`_pthread_start + 168
    frame #4: 0x00007fff8c9ee351 libsystem_pthread.dylib`thread_start + 13

  thread #5: tid = 0x2f57ab, 0x00007fff952c6f72 libsystem_kernel.dylib`mach_msg_trap + 10, name = 'com.apple.NSEventThread'
    frame #0: 0x00007fff952c6f72 libsystem_kernel.dylib`mach_msg_trap + 10
    frame #1: 0x00007fff952c63b3 libsystem_kernel.dylib`mach_msg + 55
    frame #2: 0x00007fff9f8d51c4 CoreFoundation`__CFRunLoopServiceMachPort + 212
    frame #3: 0x00007fff9f8d468c CoreFoundation`__CFRunLoopRun + 1356
    frame #4: 0x00007fff9f8d3ed8 CoreFoundation`CFRunLoopRunSpecific + 296
    frame #5: 0x00007fff9c212e99 AppKit`_NSEventThread + 149
    frame #6: 0x00007fff8c9f099d libsystem_pthread.dylib`_pthread_body + 131
    frame #7: 0x00007fff8c9f091a libsystem_pthread.dylib`_pthread_start + 168
    frame #8: 0x00007fff8c9ee351 libsystem_pthread.dylib`thread_start + 13

  thread #6: tid = 0x2f57c8, 0x00007fff952ccdb6 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #0: 0x00007fff952ccdb6 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007fff8c9f1728 libsystem_pthread.dylib`_pthread_cond_wait + 767
    frame #2: 0x0000000106b4a200 libgdk-quartz-2.0.0.dylib`select_thread_func(arg=0x0000000000000000) + 144 at gdkeventloop-quartz.c:245
    frame #3: 0x00007fff8c9f099d libsystem_pthread.dylib`_pthread_body + 131
    frame #4: 0x00007fff8c9f091a libsystem_pthread.dylib`_pthread_start + 168
    frame #5: 0x00007fff8c9ee351 libsystem_pthread.dylib`thread_start + 13
(lldb) detach

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

(lldb) quit
Process 20161 detached
Comment 1 Bernhard Urban 2016-06-16 20:54:13 UTC
That's an assert in the shutdown code, so does that happen when you close XS?
Comment 2 Stephen Shaw 2016-06-16 20:57:37 UTC
This is just want I got in a log file from someone else. I think this might have been from an XS crash or caused an XS crash, but I couldn't tell you for sure.
Comment 3 Zoltan Varga 2016-06-16 21:06:31 UTC
This should happen only during shutdown.
Comment 4 Zoltan Varga 2016-07-01 21:30:10 UTC
https://github.com/mono/mono/pull/3233
Comment 5 Alex Rønne Petersen 2016-08-29 08:33:23 UTC
Marking as resolved since Zoltan's PR has been merged.
Comment 6 asimk 2016-08-30 13:42:01 UTC
@Stephen, I have tried to reproduce this issue with previous C8 build but unable to reproduce this issue. 
I have follow the following steps to reproduce this issue.
1. Open XS.
2. Quit XS. 
Please review the screencast and let me know what additional steps we need to follow to reproduce this issue.

Screencast: http://www.screencast.com/t/yPt7fSwmDoR
Ide Log: https://gist.github.com/Asimk360/7ac260b80d5e7306506f5e44cfe345dc
Build Info: https://gist.github.com/Asimk360/b82ea9e413a6afc03b9e1269cd40a16a
Comment 7 Shruti 2016-09-07 06:23:29 UTC
@Stephen:we don't have sufficient steps to replicate this issue although we tried to reproduce as mentioned in comment(6).

It would be great If you check this issue at your end with current Beta.
Comment 8 Stephen Shaw 2016-09-07 06:41:25 UTC
@Shruti: This was pulled from someone's log files. I'm not sure if there is really a way to verify this. I'd suggest we close this and if it appears again we can then reopen it.
Comment 9 Shruti 2016-09-07 06:54:37 UTC
Thanks @Stephen for your quick response.

So as per comment (8), I am closing this issue.

Please reopen it If you experience this issue again.