[Mono-bugs] [Bug 79065][Nor] New - Threading-related exception thrown on WebRequest.Create() when called within a System.Threading.Timer callback function

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat Aug 12 14:35:03 EDT 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 iain.calder at blueyonder.co.uk.

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

--- shadow/79065	2006-08-12 14:35:03.000000000 -0400
+++ shadow/79065.tmp.17039	2006-08-12 14:35:03.000000000 -0400
@@ -0,0 +1,125 @@
+Bug#: 79065
+Product: Mono: Runtime
+Version: 1.1
+OS: 
+OS Details: Debian Sid with 1.1.13.8-1 packages, also FC5 with 1.1.16
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: iain.calder at blueyonder.co.uk               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Threading-related exception thrown on WebRequest.Create() when called within a System.Threading.Timer callback function
+
+Description of Problem:
+
+Threading-related exception thrown on WebRequest.Create() when called
+within a System.Threading.Timer callback function.
+
+
+Steps to reproduce the problem:
+
+
+using System;
+using System.Net;
+using System.Threading;
+
+class Worker
+{
+	private AutoResetEvent signal = new AutoResetEvent(false);
+
+	private static void OnTimerExpired(Object signal)
+	{
+		WebRequest.Create("http://www.google.com");
+		((AutoResetEvent)signal).Set();
+	}
+
+	public Worker()
+	{
+		new Timer(new TimerCallback(OnTimerExpired), signal, 0, Timeout.Infinite);
+	}
+
+	public void Wait()
+	{
+		signal.WaitOne();
+	}
+}
+
+class TimerTest
+{
+	static void Main()
+	{
+		Worker w = new Worker();
+		w.Wait();
+	}
+}
+
+
+Actual Results:
+
+
+:~/csharp/tests$ ./Timer.exe
+
+Unhandled Exception: System.TypeInitializationException: An exception was
+thrown by the type initializer for System.Net.WebRequest --->
+System.Configuration.ConfigurationException: Error reading
+/etc/mono/2.0/machine.config () ---> System.Threading.ThreadAbortException:
+Thread was being aborted
+in <0x00008> Mono.Xml2.XmlTextReader:ReadChar ()
+in <0x00038> Mono.Xml2.XmlTextReader:ReadWhitespace ()
+in <0x00169> Mono.Xml2.XmlTextReader:ReadContent ()
+in <0x00132> Mono.Xml2.XmlTextReader:Read ()
+in <0x000c5> System.Xml.XmlTextReader:Read ()
+in <0x003b6> System.Xml.XmlWriter:WriteNode (System.Xml.XmlReader reader,
+Boolean defattr)
+in <0x00161> System.Xml.XmlWriter:WriteNode (System.Xml.XmlReader reader,
+Boolean defattr)
+in <0x00161> System.Xml.XmlWriter:WriteNode (System.Xml.XmlReader reader,
+Boolean defattr)
+in <0x00161> System.Xml.XmlWriter:WriteNode (System.Xml.XmlReader reader,
+Boolean defattr)
+in <0x00082> System.Xml.XmlReader:ReadOuterXmlInternal ()
+in <0x0000a> System.Xml.XmlReader:ReadOuterXml ()
+in <0x0004a> System.Configuration.ConfigurationData:StorePending
+(System.String name, System.Xml.XmlTextReader reader)
+in <0x000d1> System.Configuration.ConfigurationData:ReadConfigFile
+(System.Xml.XmlTextReader reader)
+in <0x000a6> System.Configuration.ConfigurationData:Load (System.String
+fileName)--- End of inner exception stack trace ---
+
+in <0x0012f> System.Configuration.ConfigurationData:Load (System.String
+fileName)
+in <0x00066> System.Configuration.DefaultConfig:Init ()
+in <0x0000d> System.Configuration.DefaultConfig:GetConfig (System.String
+sectionName)
+in <0x0001a> System.Configuration.ConfigurationSettings:GetConfig
+(System.String sectionName)
+in <0x00028> System.Net.WebRequest:.cctor ()--- End of inner exception
+stack trace ---
+
+in <0x00000> <unknown method>
+in <0x00015> Worker:OnTimerExpired (System.Object signal)
+in (wrapper delegate-invoke) System.MulticastDelegate:invoke_void_object
+(object)
+in <0x00089> System.Threading.Timer+Runner:WaitForDueTime ()
+in <0x0003b> System.Threading.Timer+Runner:Start ()
+in (wrapper delegate-invoke) System.MulticastDelegate:invoke_void ()
+
+Expected Results:
+
+I think this should work without error.  Works OK on Windows with MS .net
+runtime.
+
+How often does this happen? 
+
+Always.
+
+
+Additional Information:
+
+Same error using 1.1.13 on FC5, 1.1.16 on FC5


More information about the mono-bugs mailing list