Bug 26557 - Crash/Deadlock when loading/running metadata from background threads at app exit
Summary: Crash/Deadlock when loading/running metadata from background threads at app exit
Alias: None
Product: Runtime
Classification: Mono
Component: General ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-01-29 13:40 UTC by Rolf Bjarne Kvinge [MSFT]
Modified: 2018-02-28 23:44 UTC (History)
4 users (show)

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

test.cs (873 bytes, application/octet-stream)
2015-01-29 13:40 UTC, Rolf Bjarne Kvinge [MSFT]
Assortion of logs (zipped) (483.24 KB, application/zip)
2015-01-29 13:41 UTC, Rolf Bjarne Kvinge [MSFT]

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:

Description Rolf Bjarne Kvinge [MSFT] 2015-01-29 13:40:37 UTC
Created attachment 9560 [details]

Compile & run attached test case.

Behaviors observed:
* Execution hangs.
* Execution completes (this is the expected behavior, this usually happens when the app exits before the background threads has started).
* Random crashes.
Comment 1 Rolf Bjarne Kvinge [MSFT] 2015-01-29 13:41:12 UTC
Created attachment 9561 [details]
Assortion of logs (zipped)
Comment 2 Zoltan Varga 2015-01-29 14:16:09 UTC
All the threads seem to be stuck here:

#0  0x00007fff8c236716 in __psynch_cvwait ()
#1  0x00007fff8eaf5c3b in _pthread_cond_wait ()
#2  0x000000010f8b62f6 in _wapi_handle_timedwait_signal_handle (handle=0x16a, timeout=0x0, alertable=1, poll=0) at handles.c:1617
#3  0x000000010f8b638d in _wapi_handle_wait_signal_handle (handle=0x16a, alertable=1) at handles.c:1562
#4  0x000000010f8d08e3 in wapi_WaitForSingleObjectEx (handle=0x16a, timeout=4294967295, alertable=1) at wait.c:194
#5  0x000000010f813e9b in mono_monitor_try_enter_internal (obj=0x110c05700, ms=4294967295, allow_interruption=1) at monitor.c:665
#6  0x000000010f814434 in ves_icall_System_Threading_Monitor_Monitor_try_enter_with_atomic_var (obj=0x110c05700, ms=4294967295, lockTaken=0x1244e38b0 "") at monitor.c:866
#7  0x000000010f8144cf in mono_monitor_enter_v4 (obj=0x110c05700, lock_taken=0x1244e38b0 "") at monitor.c:881
#8  0x000000010f60ec21 in mono_monitor_enter_v4_trampoline (regs=0x1244e37e8, code=0x110bbb293 "I?E(H??H?u?H?U?H?", obj=0x110c05700, tramp=0x110b775d5 "?F\024??\004") at mini-trampolines.c:970
Comment 3 Ludovic Henry 2018-02-28 23:44:31 UTC
I cannot reproduce with Mono (master/798c5efa52a). I ran it in a loop ~200 times and it didn't hang nor crash.