Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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 for Bug 43725 on
GitHub or Developer Community if you have new
information to add and do not yet see a matching new report.
If the latest results still closely match this report, you can use the
In special cases on GitHub you might also want the comments:
GitHub Markdown with public comments
Created attachment 17205 [details]
modded monitor-abort test
One of our automated tests, monitor-abort.exe, fails with a hang about on about five percent of builds. It doesn't appear to correlate with any hardware platform. This has been happening for at least the last week and maybe longer.
If you look at the test, what it does is start about ten worker threads. All the worker threads plus the main thread line up on a Barrier, then all the worker threads block on a monitor the main thread is holding, then the main thread calls Abort followed by Join on all the threads. (There's actually a race where the worker threads are not guaranteed to be waiting on the monitor by the time the abort comes, but that's not relevant to the problem.)
If I run the test in a loop with some added Console.WriteLines, what it becomes clear is that one of the threads is getting Abort() called but is not aborting. The `catch (ThreadAbortException)` block is never entered. The monitor is not relevant to this, you can comment out Monitor.Enter and Monitor.Exit in ThreadFunc and replace it with a while(true); and you get the same problem.
To run in a loop, I run this
(export MD=`pwd`; cd mono/tests && (MONO_PATH=$MD/mcs/class/lib/net_4_x ../../runtime/mono-wrapper $MD/mcs/class/lib/build/mcs.exe -unsafe -debug -noconfig -nologo -nowarn:0162 -nowarn:0168 -nowarn:0219 -nowarn:0414 -nowarn:0618 -nowarn:0169 -nowarn:1690 -nowarn:0649 -nowarn:0612 -nowarn:3021 -nowarn:0197 -lib:$MD/mcs/class/lib/net_4_x -r:System.dll -r:System.Xml.dll -r:System.Core.dll -r:TestDriver.dll -r:Mono.Posix.dll -out:monitor-abort.exe monitor-abort.cs))
and then this
while (export MD=`pwd`; cd mono/tests && (MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="" MONO_PATH=$MD/mcs/class/lib/net_4_x time ../../runtime/mono-wrapper monitor-abort.exe)); do :; done
The failure usually occurs pretty quickly.
My modded monitor-abort.cs with the WriteLines and while(true) is attached.