[Mono-bugs] [Bug 55911][Wis] New - Deadlock in ReaderWriterLock.UpgradeToWriterLock() (once more)
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Mon, 22 Mar 2004 13:16:00 -0500 (EST)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by mono-bug@jerryweb.info.
http://bugzilla.ximian.com/show_bug.cgi?id=55911
--- shadow/55911 2004-03-22 13:16:00.000000000 -0500
+++ shadow/55911.tmp.3921 2004-03-22 13:16:00.000000000 -0500
@@ -0,0 +1,84 @@
+Bug#: 55911
+Product: Mono: Class Libraries
+Version: unspecified
+OS: GNU/Linux [Other]
+OS Details: Gentoo
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: mono-bug@jerryweb.info
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Deadlock in ReaderWriterLock.UpgradeToWriterLock() (once more)
+
+Description of Problem:
+Deadlock in ReaderWriterLock.UpgradeToWriterLock()
+
+Steps to reproduce the problem:
+
+Run this code:
+===================================================================
+using System;
+using System.Threading;
+
+namespace Example {
+ class Class1 {
+ static ReaderWriterLock _rwl = new ReaderWriterLock();
+ static int i = 1;
+ const int _timeout = Timeout.Infinite;
+
+
+ [STAThread]
+ static void Main(string[] args) {
+ Test(i++);
+ Test(i++);
+ }
+
+ static void Test(int i) {
+ Console.WriteLine("{0} - AcquireReaderLock, before", i);
+ _rwl.AcquireReaderLock(_timeout);
+ Console.WriteLine("{0} - AcquireReaderLock, after", i);
+ try {
+ Console.WriteLine("{0} - UpgradeToWriterLock, before", i);
+ LockCookie lc = _rwl.UpgradeToWriterLock(_timeout);
+ Console.WriteLine("{0} - UpgradeToWriterLock, after", i);
+// _rwl.DowngradeFromWriterLock(ref lc);
+ Console.WriteLine("{0} - Release, before", i);
+ }
+ finally { _rwl.ReleaseReaderLock(); }
+ Console.WriteLine("{0} - End", i);
+ }
+ }
+}
+===================================================================
+
+Actual Results:
+
+MS.NET 1.0:
+1 - AcquireReaderLock, before
+1 - AcquireReaderLock, after
+1 - UpgradeToWriterLock, before
+1 - UpgradeToWriterLock, after
+1 - Release, before
+1 - End
+2 - AcquireReaderLock, before
+2 - AcquireReaderLock, after
+2 - UpgradeToWriterLock, before
+2 - UpgradeToWriterLock, after
+2 - Release, before
+2 - End
+
+Mono 0.31, Gentoo Linux:
+1 - AcquireReaderLock, before
+1 - AcquireReaderLock, after
+1 - UpgradeToWriterLock, before
+1 - UpgradeToWriterLock, after
+1 - Release, before
+1 - End
+2 - AcquireReaderLock, before
+...???