[Mono-bugs] [Bug 72970][Wis] New - RACE: Environment.Exit and new threads

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 24 Feb 2005 10:30:44 -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 vguzev@yandex.ru.

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

--- shadow/72970	2005-02-24 10:30:44.000000000 -0500
+++ shadow/72970.tmp.6060	2005-02-24 10:30:44.000000000 -0500
@@ -0,0 +1,101 @@
+Bug#: 72970
+Product: Mono: Runtime
+Version: unspecified
+OS: GNU/Linux [Other]
+OS Details: Linux skif 2.4.25 #2 SMP Fri Apr 23 14:03:00 MSD 2004 i686 athlon i386 GNU/Linux
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: vguzev@yandex.ru               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: RACE: Environment.Exit and new threads
+
+Description of Problem:
+A lot of different errors are thrown when trying to exit application 
+that's creating new threads... These types of errors depends of what 
+these new threads are busy with.
+
+Steps to reproduce the problem:
+1. mcs test.cs
+--8<----test.cs-----------------------------
+using System;
+using System.Threading;
+
+public class test {
+ public static void StartNewThread() {
+  Thread t = new Thread( new ThreadStart( StartNewThread ) );
+  t.Start();
+  DateTime dt = DateTime.Now;
+ }
+
+ public static void Main( string[] args ) {
+  Thread t = new Thread( new ThreadStart( StartNewThread ) );
+  t.Start();
+  Thread.Sleep( 1000 );
+  Environment.Exit( 0 );
+ }
+}
+--8<-----------------------------------------
+2. mono test.exe
+
+Actual Results:
+I'm getting a lot of mistakes like this:
+--8<-----------------------------------------
+Unhandled Exception: System.ArgumentException: Key duplication when 
+adding: 2005
+in <0x001d7> System.Collections.Hashtable:PutImpl (object,object,bool)
+in <0x00015> System.Collections.Hashtable:Add (object,object)
+in <0x001f5> System.CurrentTimeZone:GetDaylightChanges (int)
+in <0x0002b> System.TimeZone:IsDaylightSavingTime (System.DateTime)
+in <0x0001b> System.CurrentTimeZone:GetUtcOffset (System.DateTime)
+in <0x00064> System.DateTime:.ctor (bool,long)
+in <0x0002e> System.DateTime:get_Now ()
+in <0x0006d> test:StartNewThread ()
+in <0x00041> (wrapper delegate-invoke) 
+System.MulticastDelegate:invoke_void ()
+--8<-----------------------------------------
+
+Sometimes the application just hangs on...
+
+What's interesting, if I replace the string 'DateTime dt = DateTime.Now;' 
+with the following line:
+IPAddress hostadd = Dns.Resolve( Dns.GetHostName() ).AddressList[0];
+then I'm getting the following error:
+--8<-----------------------------------------
+[vadim@skif testexitwithnewthreads]$ mono test.exe
+
+** ERROR **: : EnterCriticalSection failed: Invalid argument
+aborting...
+Aborted
+--8<-----------------------------------------
+
+Expected Results:
+Should work OK with Mono, as it's working well on MS.Net.
+
+How often does this happen? 
+Always
+
+Additional Information:
+--8<-----------------------------------------
+[vadim@skif testexitwithnewthreads]$ uname -a
+Linux skif 2.4.25 #2 SMP Fri Apr 23 14:03:00 MSD 2004 i686 athlon i386 
+GNU/Linux
+[vadim@skif testexitwithnewthreads]$ mono --version
+Mono JIT compiler version 1.1.4, (C) 2002-2004 Novell, Inc and 
+Contributors. www.go-mono.com
+        TLS:           __thread
+        GC:            Included Boehm (with typed GC)
+        SIGSEGV      : normal
+        Globalization: none
+--8<-----------------------------------------
+
+
+Best regards,
+Vadim B. Guzev
+http://u.pereslavl.ru/~vadim/MCSharp/