Bug 16794 - GC crashes when exiting application
Summary: GC crashes when exiting application
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: GC ()
Version: 3.2.x
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-12-13 21:26 UTC by Sergey Zhukov
Modified: 2013-12-16 14:10 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Sergey Zhukov 2013-12-13 21:26:41 UTC
Sometimes, when I exit mono applications by Ctrl+C I've got SIGSEGV. Seems this is a new error, at least I did not saw it in two weeks ago builds from master branch.

OS: Ubuntu linux 32 bit

Mono Runtime Engine version 3.2.7 (master/01b7a50 Sat Dec 14 01:48:49 NOVT 2013)
Copyright (C) 2002-2013 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           __thread
	SIGSEGV:       altstack
	Notifications: epoll
	Architecture:  x86
	Disabled:      none
	Misc:          softdebug 
	LLVM:          yes(3.4svn-mono-mono/e656cac)
	GC:            sgen


failed to suspend thread 0xb7046b40, hopefully it is dead
Stacktrace:


Native stacktrace:

	/usr/bin/cli() [0x8163ad3]
	/usr/bin/cli() [0x81c2aac]
	/usr/bin/cli() [0x80c8c1d]
	[0xb778f40c]
	/usr/bin/cli() [0x82f2cff]
	/usr/bin/cli() [0x8262c43]
	/usr/bin/cli(mono_jit_info_table_find+0x1f) [0x8262cff]
	/usr/bin/cli() [0x82f4afb]
	/usr/bin/cli() [0x824a48b]
	/usr/bin/cli() [0x824b164]
	/usr/bin/cli() [0x81f1fde]
	[0xb704eeec]
	/usr/lib/mono/4.5/mscorlib.dll.so(+0x77dd6) [0xb5ae3dd6]
	[0xb71aa157]
	/usr/bin/cli() [0x80cdccd]
	[0xb6c02af0]

Debug info from gdb:

Mono support loaded.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
[New Thread 0xb53ffb40 (LWP 32106)]
[New Thread 0xb7046b40 (LWP 32105)]
[New Thread 0xb5a6bb40 (LWP 31941)]
0xb778f424 in __kernel_vsyscall ()
  Id   Target Id         Frame 
  4    Thread 0xb5a6bb40 (LWP 31941) "cli" 0xb778f424 in __kernel_vsyscall ()
  3    Thread 0xb7046b40 (LWP 32105) "cli" 0xb778f424 in __kernel_vsyscall ()
  2    Thread 0xb53ffb40 (LWP 32106) "cli" 0xb778f424 in __kernel_vsyscall ()
* 1    Thread 0xb746b740 (LWP 31939) "cli" 0xb778f424 in __kernel_vsyscall ()

Thread 4 (Thread 0xb5a6bb40 (LWP 31941)):
#0  0xb778f424 in __kernel_vsyscall ()
#1  0xb7641cc5 in sem_wait@@GLIBC_2.1 () at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/sem_wait.S:80
#2  0x082f0a68 in mono_sem_wait (sem=0x93a3744, alertable=1) at mono-semaphore.c:119
#3  0x08266e83 in finalizer_thread (unused=0x0) at gc.c:1073
#4  0x0824a099 in start_wrapper_internal (data=0xb339898) at threads.c:609
#5  start_wrapper (data=0xb339898) at threads.c:654
#6  0x082e4652 in thread_start_routine (args=0xb308bfc) at wthreads.c:294
#7  0x082f51de in inner_start_thread (arg=0xb33a8f8) at mono-threads-posix.c:49
#8  0xb763bd4c in start_thread (arg=0xb5a6bb40) at pthread_create.c:308
#9  0xb755cbae in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 3 (Thread 0xb7046b40 (LWP 32105)):
#0  0xb778f424 in __kernel_vsyscall ()
#1  0xb7641cc5 in sem_wait@@GLIBC_2.1 () at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/sem_wait.S:80
#2  0x082f0a68 in mono_sem_wait (sem=0xb54004a4, alertable=0) at mono-semaphore.c:119
#3  0x082f50e0 in suspend_signal_handler (_dummy=35, info=0xb7045dbc, context=0xb7045e3c) at mono-threads-posix.c:106
#4  <signal handler called>
#5  mono_lock_free_free (ptr=0xb71d4060) at lock-free-alloc.c:477
#6  0x082aed90 in sgen_hash_table_remove (hash_table=0x939bb60, key=0xb5400f78, data_return=0xb70461d8) at sgen-hash-table.c:184
#7  0x08299f06 in mono_gc_deregister_root (addr=0xb5400f78 "x\017@\265") at sgen-gc.c:3973
#8  0x082b00f0 in mono_gc_free_fixed (addr=0xb5400f78) at sgen-alloc.c:637
#9  0x0824726b in mono_free_static_data (threadlocal=1, static_data=0xb5400f78) at threads.c:3828
#10 thread_cleanup (thread=0xb7194380) at threads.c:421
#11 0x0824a0a0 in start_wrapper_internal (data=0xb5803608) at threads.c:632
#12 start_wrapper (data=0xb5803608) at threads.c:654
#13 0x082e4652 in thread_start_routine (args=0xb308c84) at wthreads.c:294
#14 0x082f51de in inner_start_thread (arg=0xb58035a8) at mono-threads-posix.c:49
#15 0xb763bd4c in start_thread (arg=0xb7046b40) at pthread_create.c:308
#16 0xb755cbae in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 2 (Thread 0xb53ffb40 (LWP 32106)):
#0  0xb778f424 in __kernel_vsyscall ()
#1  0xb764398b in waitpid () at ../sysdeps/unix/syscall-template.S:82
#2  0x08163b7f in mono_handle_native_sigsegv (signal=11, ctx=0xb725bd0c) at mini-exceptions.c:2299
#3  0x081c2aac in mono_arch_handle_altstack_exception (sigctx=0xb725bd0c, fault_addr=0xc0, stack_ovf=0) at exceptions-x86.c:1163
#4  0x080c8c1d in mono_sigsegv_signal_handler (_dummy=11, info=0xb725bc8c, context=0xb725bd0c) at mini.c:6743
#5  <signal handler called>
#6  get_hazardous_pointer (pp=0xc0, hp=0xb71e1030, hazard_index=0) at hazard-pointer.c:180
#7  0x08262c43 in mono_jit_info_table_find_internal (domain=0x0, addr=0x82f3847 "\211\301\201", <incomplete sequence \341>, try_aot=1) at domain.c:397
#8  0x08262cff in mono_jit_info_table_find (domain=0x0, addr=0x82f3847 "\211\301\201", <incomplete sequence \341>) at domain.c:421
#9  0x082f4afb in is_thread_in_critical_region (info=<optimized out>) at mono-threads.c:498
#10 mono_thread_info_safe_suspend_sync (id=3070520128, interrupt_kernel=1) at mono-threads.c:534
#11 0x0824a48b in suspend_thread_internal (thread=0xb7194380, interrupt=1) at threads.c:4796
#12 0x0824b164 in mono_thread_suspend_all_other_threads () at threads.c:3258
#13 0x081f1fde in ves_icall_System_Environment_Exit (result=58) at icall.c:6513
#14 0xb704eeec in ?? ()
#15 0xb5ae3dd6 in System.Console:DoConsoleCancelEvent () at <unknown>:808
#16 0xb71aa157 in ?? ()
#17 0x080cdccd in mono_jit_runtime_invoke (method="InternalCancelHandler:Invoke ()", obj=0xb717c2b0, params=0xb53ff100, exc=0xb53ff214) at mini.c:6628
#18 0x0826f17f in mono_runtime_invoke (method="InternalCancelHandler:Invoke ()", obj=0xb717c2b0, params=0xb53ff100, exc=0xb53ff214) at object.c:2827
#19 0x08272a1b in mono_runtime_invoke_array (method="InternalCancelHandler:Invoke ()", obj=0xb717c2b0, params=0xb6c01a88, exc=0xb53ff214) at object.c:4264
#20 0x082742a2 in mono_message_invoke (target=0xb717c2b0, msg=0xb6c01a30, exc=0xb53ff214, out_args=0xb53ff218) at object.c:6023
#21 0x0824f49d in mono_async_invoke (ares=0xb6c01ad8, tp=<optimized out>) at threadpool.c:627
#22 async_invoke_thread (data=0xb6c01ad8) at threadpool.c:1517
#23 0x0824a099 in start_wrapper_internal (data=0xb58035c8) at threads.c:609
#24 start_wrapper (data=0xb58035c8) at threads.c:654
#25 0x082e4652 in thread_start_routine (args=0xb308d0c) at wthreads.c:294
#26 0x082f51de in inner_start_thread (arg=0xb58036a8) at mono-threads-posix.c:49
#27 0xb763bd4c in start_thread (arg=0xb53ffb40) at pthread_create.c:308
#28 0xb755cbae in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 1 (Thread 0xb746b740 (LWP 31939)):
#0  0xb778f424 in __kernel_vsyscall ()
#1  0xb7641cc5 in sem_wait@@GLIBC_2.1 () at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/sem_wait.S:80
#2  0x082f0a68 in mono_sem_wait (sem=0xb311034, alertable=0) at mono-semaphore.c:119
#3  0x082f50e0 in suspend_signal_handler (_dummy=35, info=0xbfb2cdec, context=0xbfb2ce6c) at mono-threads-posix.c:106
#4  <signal handler called>
#5  0xb70484b0 in ?? ()
#6  0xb70483b4 in ?? ()
#7  0xb71af626 in ?? ()
#8  0xb71ae3f1 in ?? ()
#9  0xb71ae03c in ?? ()
#10 0xb71af5f8 in ?? ()
#11 0xb7048038 in ?? ()
#12 0xb71aeed3 in ?? ()
#13 0x080cdccd in mono_jit_runtime_invoke (method="Benchmark.Benchmarks:Roots ()", obj=0xb6c06e48, params=0x0, exc=0x0) at mini.c:6628
#14 0x0826f17f in mono_runtime_invoke (method="Benchmark.Benchmarks:Roots ()", obj=0xb6c06e48, params=0x0, exc=0x0) at object.c:2827
#15 0x08272a1b in mono_runtime_invoke_array (method="Benchmark.Benchmarks:Roots ()", obj=0xb6c06e48, params=0x0, exc=0x0) at object.c:4264
#16 0x081ed8d8 in ves_icall_InternalInvoke (method=0xb71883d0, this=0xb6c06e48, params=0x0, exc=0xbfb2d58c) at icall.c:2841
#17 0xb71ae7d0 in ?? ()
#18 0xb5be0c00 in System.Reflection.MonoMethod:Invoke (this=..., obj=Benchmark.Benchmarks, invokeAttr=Default, binder=..., parameters=null, culture=...) at <unknown>:231
#19 0xb5bdba50 in System.Reflection.MethodBase:Invoke (this=..., obj=Benchmark.Benchmarks, parameters=null) from /usr/lib/mono/4.5/mscorlib.dll.so
#20 0xb71ae6b4 in ?? ()
#21 0xb71ae3f1 in ?? ()
#22 0xb71ae03c in ?? ()
#23 0xb71abccc in ?? ()
#24 0xb71aa688 in ?? ()
#25 0xb71a7e74 in ?? ()
#26 0xb71a80d6 in ?? ()
#27 0x080cdccd in mono_jit_runtime_invoke (method="Benchmark.Program:Main ()", obj=0x0, params=0xbfb2d95c, exc=0x0) at mini.c:6628
#28 0x0826f17f in mono_runtime_invoke (method="Benchmark.Program:Main ()", obj=0x0, params=0xbfb2d95c, exc=0x0) at object.c:2827
#29 0x08271231 in mono_runtime_exec_main (method="Benchmark.Program:Main ()", args=0xb6c00798, exc=0x0) at object.c:4060
#30 0x08137313 in main_thread_handler (user_data=<synthetic pointer>) at driver.c:1065
#31 mono_main (argc=2, argv=0xbfb2db24) at driver.c:2009
#32 0x080b309c in mono_main_with_options (argv=0xbfb2db24, argc=2) at main.c:91
#33 main (argc=2, argv=0xbfb2db24) at main.c:12
Comment 1 Rodrigo Kumpera 2013-12-16 14:10:18 UTC
Fixed in master. Thanks for the report.