[Mono-bugs] [Bug 74714][Nor] New - ** ERROR **: file handles.c: line 940 (_wapi_handle_unref): assertion failed: (thr_ret == 0)

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 24 Apr 2005 17:38:29 -0400 (EDT)


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 bmaurer@users.sf.net.

http://bugzilla.ximian.com/show_bug.cgi?id=74714

--- shadow/74714	2005-04-24 17:38:29.000000000 -0400
+++ shadow/74714.tmp.22231	2005-04-24 17:38:29.000000000 -0400
@@ -0,0 +1,99 @@
+Bug#: 74714
+Product: Mono: Runtime
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: io-layer
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: bmaurer@users.sf.net               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: ** ERROR **: file handles.c: line 940 (_wapi_handle_unref): assertion failed: (thr_ret == 0)
+
+Using the following test case:
+
+using System;
+using System.Threading;
+
+public class EventTest {
+	
+	EventTest ()
+	{
+		(t1 = new Thread (new ThreadStart (W1))).Start ();
+		(t2 = new Thread (new ThreadStart (W2))).Start ();
+	}
+	
+	public Thread t1, t2;
+	
+	const int ITERS = 10000;
+	
+	AutoResetEvent Event1 = new AutoResetEvent(false);
+	AutoResetEvent Event2 = new AutoResetEvent(true);
+	
+	int xx;
+	void W1 ()
+	{
+		for (int i = 0; i < ITERS; i++) {
+			Event1.WaitOne ();
+			
+			Event1.Close ();
+			Event1 = new AutoResetEvent (false);
+
+			if (xx != 1)
+				Console.WriteLine ("xx != 1");
+			
+			xx = 0;
+			
+			Event2.Set ();
+		}
+	}
+	
+	void W2 ()
+	{ 
+		for (int i = 0; i < ITERS; i++) {
+			Event2.WaitOne ();
+			
+			Event2.Close ();
+			Event2 = new AutoResetEvent (false);
+			
+			if (xx != 0)
+				Console.WriteLine ("xx != 0");
+			
+			xx = 1;
+
+			Event1.Set ();
+		}
+	}
+	
+	static void Main ()
+	{
+		int t0 = Environment.TickCount;
+		
+		EventTest [] x = new EventTest [5];
+		for (int i = 0; i < x.Length; i ++) {
+			x [i] = new EventTest ();
+		}
+		
+		foreach (EventTest et in x) {
+			et.t1.Join ();
+			et.t2.Join ();
+		}
+		
+		Console.WriteLine (Environment.TickCount - t0);
+	}
+}
+
+I get the following assertion every 20-30 runs:
+
+** ERROR **: file handles.c: line 940 (_wapi_handle_unref): assertion
+failed: (thr_ret == 0)
+aborting...
+Aborted
+
+I tested on x86 and x86-64.