[Mono-bugs] [Bug 80063][Nor] New - Signals abort Thread.Sleep

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Nov 27 05:06:11 EST 2006


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 pawel.sakowski at mindbreeze.com.

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

--- shadow/80063	2006-11-27 05:06:11.000000000 -0500
+++ shadow/80063.tmp.19322	2006-11-27 05:06:11.000000000 -0500
@@ -0,0 +1,63 @@
+Bug#: 80063
+Product: Mono: Runtime
+Version: 1.2
+OS: GNU/Linux [Other]
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: io-layer
+AssignedTo: dick at ximian.com                            
+ReportedBy: pawel.sakowski at mindbreeze.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Signals abort Thread.Sleep
+
+Description of Problem:
+When a non-fatal signal arrives at a process, running sleeps get interrupted.
+
+Steps to reproduce the problem:
+1. Invoke the following:
+
+using System;
+using System.Runtime.InteropServices;
+using System.Threading;
+
+class X {
+  const int SIGQUIT = 3;
+  [DllImport("libc")]
+  static extern int raise(int signal);
+
+  static void Main() {
+    new Thread(Raiser).Start();
+    DateTime before = DateTime.UtcNow;
+    Thread.Sleep(4000);
+    DateTime after = DateTime.UtcNow;
+    int millis = after.Subtract(before).Milliseconds;
+    Console.WriteLine("Slept for {0} ms", millis);
+    if (millis < 3900) throw new Exception("Too few millis");
+  }
+
+  static void Raiser() {
+    Thread.Sleep(500);
+    raise(SIGQUIT);
+  }
+}
+
+Actual Results:
+Full thread dump:
+[cut irrelevant stack traces]
+Slept for 501 ms
+
+Unhandled Exception: System.Exception: Too few millis
+  at X.Main () [0x00000]
+
+Expected Results:
+Reissuing the sleep after EINTR if necessary, always giving timestamp
+difference of at least 4000 ms (+- system clock inaccuracies).
+
+How often does this happen? 
+Always. The actual time varies between 500 and 610 ms.


More information about the mono-bugs mailing list