[Mono-bugs] [Bug 24104] New - uncaught exceptions in threads other than the main thread crash mono

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
2 May 2002 03:58:45 -0000

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 linus@linus.com.


--- shadow/24104	Wed May  1 23:58:45 2002
+++ shadow/24104.tmp.6279	Wed May  1 23:58:45 2002
@@ -0,0 +1,70 @@
+Bug#: 24104
+Product: Mono/Runtime
+Version: unspecified
+OS Details: 
+Status: NEW   
+Priority: Critical
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: linus@linus.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+Summary: uncaught exceptions in threads other than the main thread crash mono
+Description of Problem:
+If there is an uncaught exception in a thread other than the main thread, 
+mono will crash (I've only tested Windows). This is becuase the code in 
+jit/exception.c assumes there is only one stack. It compares EBP to a 
+single global variable mono_end_of_stack that was initialized from a 
+stack variable in the main thread.
+Steps to reproduce the problem:
+The following program will crash when run with mono.
+// MultiThreadExceptionTest.cs
+using System;
+using System.Threading;
+public class MultiThreadExceptionTest {
+	public static void MyThreadStart() {
+		Console.WriteLine("{0} started", 
+		throw new Exception();
+	}
+	public static void Main() {
+		Thread t1 = new Thread(new ThreadStart
+		t1.Name = "Thread 1";
+		Thread t2 = new Thread(new ThreadStart
+		t2.Name = "Thread 2";
+		t1.Start();
+		t2.Start();
+	}
+Expected Results:
+The AppDomain.UncaughtException event should be called for each thread.
+Additional Information:
+The obvious solution is to keep an _end_of_stack for each thread. I don't 
+know anything about Windows Structured Exception Handling (SEH), but I 
+read on the Rotor list that .Net exceptions are somehow "compatible" with 
+SEH. I think there is some level of interoperability between unmanaged 
+and managed exceptions in .Net on Windows. I don't know if this is 
+desirable in mono or if an analog exists on Linux.
+I don't know if the same problem exists in mint.