Bug 21164 - Assertion at mono-threads.c:157, condition `result' not met
Summary: Assertion at mono-threads.c:157, condition `result' not met
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 7.2.5
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Zoltan Varga
Depends on:
Reported: 2014-07-07 18:13 UTC by Frank A. Krueger
Modified: 2014-09-03 10:03 UTC (History)
8 users (show)

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 Developer Community or GitHub 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:

Description Frank A. Krueger 2014-07-07 18:13:17 UTC
I get the following assert sporadically (a few times a day). 

<Critical>: * Assertion at ../../../../../mono/mono/utils/mono-threads.c:157, condition `result' not met

This seems to be a regression as the app has gone months without this error, but it just started after upgrading to 7.2.5. My code does a lot of async and Task.Runs so I'm not sure exactly what's triggering this error.

Thread 18 Crashed:
0   libsystem_kernel.dylib        	0x38ae01f0 __pthread_kill + 8
1   libsystem_pthread.dylib       	0x38b487b3 pthread_kill + 55
2   libsystem_c.dylib             	0x38a90ff5 abort + 73
3   Mocast                        	0x006d3489 mono_handle_native_sigsegv (mini-exceptions.c:2341)
4   Mocast                        	0x006d817b sigabrt_signal_handler (mini-posix.c:206)
5   libsystem_platform.dylib      	0x38b43721 _sigtramp + 41
6   libsystem_pthread.dylib       	0x38b487b3 pthread_kill + 55
7   libsystem_c.dylib             	0x38a90ff5 abort + 73
8   Mocast                        	0x00767083 monoeg_assertion_message (goutput.c:197)
9   Mocast                        	0x007631df mono_thread_info_attach (mono-threads.c:157)
10  Mocast                        	0x00762d33 inner_start_thread (mono-threads-posix.c:73)
11  libsystem_pthread.dylib       	0x38b47957 _pthread_body + 139
12  libsystem_pthread.dylib       	0x38b478c7 _pthread_start + 99
13  libsystem_pthread.dylib       	0x38b45ae4 thread_start + 4
Comment 1 Zoltan Varga 2014-07-07 20:34:14 UTC
The assert happens when mono_thread_info_insert () fails. That can fail if 'info' is already in the list, or there is a problem with the list implementation. I don't see how the first case can happen:
- info is allocated just before the register_thread () call in mono_thread_info_attach (), and register_thread () is only called from there. So the only way for it to be registered twice is if its freed before its removed from the list, and another thread gets the same pointer value.
- info is freed in free_thread_info (), which is called from unregister_thread () after it has been removed from the thread list by the call to mono_threads_unregister_current_thread ().
Comment 2 Zoltan Varga 2014-08-05 14:46:56 UTC
Do you have some kind of testcase/test app ? We are having trouble reproducing this problem.
Comment 10 Miguel de Icaza [MSFT] 2014-08-22 15:09:13 UTC
Can we do a lane based on the latest stable with this fix applied?
Comment 12 Sebastien Pouliot 2014-09-03 10:03:48 UTC
Hello Frank, did you have a chance to test the package to see if it fixed your issue ?