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 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.
Created attachment 4598 [details]
If you start my Application (simple counter++ application with 10 threads and readerwriterlockslim)
the Application hangs immediately (on my pc intel i5 <10 Sec).
Tested on Linux Ubuntu with Mono 3.2.1, Windows Mono 3.0.10, Windows MS.Net
On MS.Net all OK.
On Any Mono/OS the Application hangs immediately.
Performance (all the same hardware):
On Windows with MS.Net the counter count every sec. <> 1000000.
On Windows with Mono (3.0.10) the counter count every seconds < 1000
On Linux with Mono (trunk 3.2.1) the counter count every seconds <> 100000
I don't understand the diff.
The same on ReaderWriteLock
I Test it with Monitor.Enter/Exit. No problems.
I have started my application with 5 threads. After 3 Sec the Application hangs.
I Checked the ReaderWriterLockSlim Properties and see:
WaitingReaderCount = 41 (only 5 threads no recursion!)
WaitingWriteCount = -2 (negativ!?!)
All Threads are Waiting to Read. (ManualResetEventSlim)
Yeah, the code is very racy.
Probably the place where is all goes wrong is ExitWriteLock because it does not remove RwWait flag when it should. When I tried to fix the issue another race shows up where we end up in ExitWriteLock without RwWrite flag.
WaitingWriteCount and WaitingReaderCount counters are racy too, so you cannot rely on them.
Jeremie, can you look into it
We have replaced enough code in Mono with Reference Source code that at some point this got fixed.