[Mono-bugs] [Bug 76047][Nor] New - Thread.Abort() sometimes crash runtime or throws NullReferenceException when aborted thread already finished

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Sep 9 20:10:29 EDT 2005


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 jan.oravec at 6com.sk.

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

--- shadow/76047	2005-09-09 20:10:29.000000000 -0400
+++ shadow/76047.tmp.15616	2005-09-09 20:10:29.000000000 -0400
@@ -0,0 +1,74 @@
+Bug#: 76047
+Product: Mono: Runtime
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: io-layer
+AssignedTo: dick at ximian.com                            
+ReportedBy: jan.oravec at 6com.sk               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Thread.Abort() sometimes crash runtime or throws NullReferenceException when aborted thread already finished
+
+The following code triggers segmentation fault or exception throwing on
+both Mono from current SVN and 1.1.8.3:
+
+using System.Threading;
+
+class M
+{
+  static void Empty () {}
+   
+  static void Create ()
+  {
+    Thread t = new Thread (new ThreadStart (Empty));
+    t.Start ();
+    
+    Thread.Sleep(1000);
+    
+    t.Abort ();
+  }
+   
+  public static void Main ()
+  {
+    for (int i=0; i<100; i++)
+      new Thread (new ThreadStart (Create)).Start ();
+  }  
+}
+
+
+The 'for' loop is important, I was not able to trigger this bug with only a
+few threads.
+
+
+
+Steps to reproduce the problem:
+1. compile the code above
+2. run it
+3. get a few exceptions or segmentation fault
+
+Actual Results:
+
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+in <0x00000> <unknown method>
+in (wrapper managed-to-native) System.Threading.Thread:Abort_internal (object)
+in <0x0001e> System.Threading.Thread:Abort ()
+in <0x0007a> M:Create ()
+in (wrapper delegate-invoke) System.MulticastDelegate:invoke_void ()
+
+
+Expected Results:
+
+No exceptions.
+
+
+How often does this happen? 
+
+Almost always with the above example.


More information about the mono-bugs mailing list