[Mono-bugs] [Bug 74713][Maj] New - System.IO.IOException: Invalid handle to path "/tmp/tmp4d062ea3"

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 24 Apr 2005 15:53:24 -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=74713

--- shadow/74713	2005-04-24 15:53:24.000000000 -0400
+++ shadow/74713.tmp.21830	2005-04-24 15:53:24.000000000 -0400
@@ -0,0 +1,80 @@
+Bug#: 74713
+Product: Mono: Runtime
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: io-layer
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: bmaurer@users.sf.net               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: System.IO.IOException: Invalid handle to path "/tmp/tmp4d062ea3"
+
+On this test case:
+
+using System;
+using System.IO;
+using System.Threading;
+public class Test {
+	static Thread t = null;
+	static void Main ()
+	{
+		for (int i = 0; i < 5; i ++) {
+			Thread t = new Thread (Worker);
+			t.Start ();
+		}
+	}
+	
+	static void Worker ()
+	{
+		while (true) {
+			try {
+				string f = Path.GetTempFileName ();
+				TextWriter w = File.CreateText (f);
+				
+				for (int i = 0; i < 100; i ++)
+					w.WriteLine (i);
+				
+				w.Close ();
+				File.Delete (f);
+				
+				Console.Write (".");
+			} catch (Exception e) {
+				Console.WriteLine ("\nCaught exception: \n" + e.ToString ());
+			}
+		}
+	}
+}
+
+I randomly get the following error:
+
+Caught exception:
+System.IO.IOException: Invalid handle to path "/tmp/tmp7c082518"
+in <0x000ac> System.IO.FileStream:SetLength (Int64 length)
+in <0x00136> System.IO.StreamWriter:.ctor (System.String path, Boolean
+append, System.Text.Encoding encoding, Int32 bufferSize)
+in <0x0002a> System.IO.StreamWriter:.ctor (System.String path, Boolean append)
+in (wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor
+(string,bool)
+in <0x0001f> System.IO.File:CreateText (System.String path)
+in <0x0002f> Test:Worker ()
+
+
+On different computers, it comes up with different stack traces. For
+example, on an amd64 box I got the following trace 
+
+Caught exception:
+System.IO.IOException: Invalid handle to path "/tmp/tmp4d062ea3"
+in <0x00085> System.IO.FileStream:FlushBuffer ()
+in (wrapper remoting-invoke-with-check) System.IO.FileStream:FlushBuffer ()
+in <0x00016> System.IO.FileStream:Flush ()
+in <0x00033> System.IO.StreamWriter:Flush ()
+in <0x00024> System.IO.StreamWriter:Dispose (Boolean disposing)
+in <0x00014> System.IO.StreamWriter:Close ()
+in <0x00068> Test:Worker ()