Bug 32601 - Mono 4.0 crashes when aborting threads
Summary: Mono 4.0 crashes when aborting threads
Status: NEW
Alias: None
Product: Runtime
Classification: Mono
Component: General (show other bugs)
Version: 4.0.0
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-07-30 04:45 UTC by Kirill
Modified: 2016-03-29 20:02 UTC (History)
4 users (show)

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


Attachments
Prove (40.96 KB, image/png)
2015-08-03 22:49 UTC, Kirill
Details

Description Kirill 2015-07-30 04:45:53 UTC
Hi all!

I'm using mono 4.0.2.5/c99aa0c stable under Ubuntu 14.04.2 LTS and I would like to show you strange mono's bug.
Just run that program:

	class MainClass
	{
		static void WorkFunc()
		{

		}

		static void Main(string[] args)
		{
			for(int i = 0; i< 100000; i++)
			{
				var workThread = new Thread (WorkFunc) {
					IsBackground = true,
				};
				workThread.Start ();
				workThread.Abort ();
			}
		}
	}

Under monodevelop you will not see anything bad, but in console the result will be terrible:

* Assertion at mini-exceptions.c:850, condition `domain' not met

Stacktrace:

* Assertion at mini-exceptions.c:856, condition `unwind_options == MONO_UNWIND_NONE' not met

Please fix it, I'm ready to provide any additional info.

Kind regards,
Kirill
Comment 1 Zoltan Varga 2015-08-03 16:28:27 UTC
Can't reproduce this using that version.
Comment 2 Kirill 2015-08-03 22:49:02 UTC
Created attachment 12346 [details]
Prove

Did you start it via console?
Comment 3 Kirill 2015-08-03 22:49:49 UTC
I've attached screenshot for you.
Comment 4 yves crespin 2016-03-29 14:07:37 UTC
* Assertion at mini-exceptions.c:850, condition `domain' not met


Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.Environment.Exit (int) <0xffffffff>
  at ExecuteActionDfnInformationPublicCheckavailability.Main (string[]) <0x00290>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

.../mono-4.0.3/bin/mono() [0x4b113c]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xf0a0) [0x7f12a26c60a0]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x35) [0x7f12a235c125]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x180) [0x7f12a235f3a0]
.../mono-4.0.3/bin/mono() [0x6243e9]
.../mono-4.0.3/bin/mono() [0x6245f7]
.../mono-4.0.3/bin/mono() [0x624746]
.../mono-4.0.3/bin/mono() [0x4affc6]
.../mono-4.0.3/bin/mono() [0x4b003c]
.../mono-4.0.3/bin/mono() [0x57fb41]
.../mono-4.0.3/bin/mono() [0x583bcb]
.../mono-4.0.3/bin/mono() [0x58407d]
.../mono-4.0.3/bin/mono() [0x533e36]
[0x41a8d0a2]

Debug info from gdb:

Mono support loaded.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7f129f031700 (LWP 19948)]
[New Thread 0x7f129f072700 (LWP 19947)]
[New Thread 0x7f129f4b5700 (LWP 19944)]
[New Thread 0x7f12a1a17700 (LWP 19943)]
0x00007f12a26c5c8d in __libc_waitpid (pid=pid@entry=19949, stat_loc=<optimized out>, stat_loc@entry=0x7ffe99c8514c, options=options@entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:41
41	../sysdeps/unix/sysv/linux/waitpid.c: Aucun fichier ou dossier de ce type.
  Id   Target Id         Frame 
  5    Thread 0x7f12a1a17700 (LWP 19943) "Finalizer" sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86
  4    Thread 0x7f129f4b5700 (LWP 19944) "Timer-Scheduler" pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:216
  3    Thread 0x7f129f072700 (LWP 19947) "mono" 0x00007f12a2408963 in epoll_wait () at ../sysdeps/unix/syscall-template.S:82
  2    Thread 0x7f129f031700 (LWP 19948) "IO Threadpool w" sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86
* 1    Thread 0x7f12a3165760 (LWP 19942) "mono" 0x00007f12a26c5c8d in __libc_waitpid (pid=pid@entry=19949, stat_loc=<optimized out>, stat_loc@entry=0x7ffe99c8514c, options=options@entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:41

Thread 5 (Thread 0x7f12a1a17700 (LWP 19943)):
#0  sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86
#1  0x0000000000619948 in mono_sem_wait (sem=sem@entry=0x93f500, alertable=alertable@entry=1) at mono-semaphore.c:101
#2  0x000000000059e1fe in finalizer_thread (unused=<optimized out>) at gc.c:1074
#3  0x00000000005838a8 in start_wrapper_internal (data=<optimized out>) at threads.c:664
#4  start_wrapper (data=<optimized out>) at threads.c:711
#5  0x000000000061e6b6 in inner_start_thread (arg=0x7ffe99c86ca0) at mono-threads-posix.c:92
#6  0x00007f12a26bdb50 in start_thread (arg=<optimized out>) at pthread_create.c:304
#7  0x00007f12a240830d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#8  0x0000000000000000 in ?? ()

Thread 4 (Thread 0x7f129f4b5700 (LWP 19944)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:216
#1  0x00000000005f9087 in _wapi_handle_timedwait_signal_handle (handle=handle@entry=0x409, timeout=timeout@entry=0x7f129f4b47a0, alertable=alertable@entry=1, poll=poll@entry=0) at handles.c:1600
#2  0x000000000060bbac in wapi_WaitForSingleObjectEx (handle=0x409, timeout=timeout@entry=99999, alertable=alertable@entry=1) at wait.c:196
#3  0x000000000058235e in mono_wait_uninterrupted (thread=thread@entry=0x7f12a1abc3c0, multiple=multiple@entry=0, numhandles=numhandles@entry=1, handles=handles@entry=0x7f129f4b4848, waitall=waitall@entry=0, ms=ms@entry=99999, alertable=1) at threads.c:1376
#4  0x00000000005832d9 in ves_icall_System_Threading_WaitHandle_WaitOne_internal (this=<optimized out>, handle=0x409, ms=99999, exitContext=<optimized out>) at threads.c:1509
#5  0x0000000041a45a3d in ?? ()
#6  0x0000000000000038 in ?? ()
#7  0x00000000022b9f28 in ?? ()
#8  0x000000000001869f in ?? ()
#9  0x00007f12a14c4a88 in ?? ()
#10 0x000000000001869f in ?? ()
#11 0x00000000022d9880 in ?? ()
#12 0x0000000041a459c6 in ?? ()
#13 0x00007f129f4b4900 in ?? ()
#14 0x00007f129f4b4870 in ?? ()
/tmp/buildd/gdb-7.4.1+dfsg/gdb/dwarf2-frame.c:683: internal-error: Unknown CFI encountered.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) [answered Y; input not from terminal]
/tmp/buildd/gdb-7.4.1+dfsg/gdb/dwarf2-frame.c:683: internal-error: Unknown CFI encountered.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) [answered Y; input not from terminal]

=================================================================
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.
=================================================================
Comment 5 Zoltan Varga 2016-03-29 20:02:14 UTC
Please try the stable mono version 4.2:
http://www.mono-project.com/download/

Note You need to log in before you can comment on or make changes to this bug.