[Mono-bugs] [Bug 53222][Maj] New - Asynchronous DNS methods hang on call to EndXXXX

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 22 Jan 2004 14:00:18 -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 jconley@winfessor.com.

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

--- shadow/53222	2004-01-22 14:00:17.000000000 -0500
+++ shadow/53222.tmp.17841	2004-01-22 14:00:17.000000000 -0500
@@ -0,0 +1,92 @@
+Bug#: 53222
+Product: Mono/Class Libraries
+Version: unspecified
+OS: 
+OS Details: Windows Server 2003 Enterprise Edition
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Major
+Component: System
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: jconley@winfessor.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Asynchronous DNS methods hang on call to EndXXXX
+
+Description of Problem:  The asynchronous DNS methods simply hang when 
+EndXXXX is called from within the callback method.  It's like the event 
+never gets set.  The synchronous Resolve and other methods work just fine.
+
+
+Steps to reproduce the problem:
+1. Call BeginResolve (or any other Begin method) with an AsyncCallback 
+method specified
+2. Call EndResolve from within the AsyncCallback
+3. Watch as execution hangs.
+
+Actual Results:
+Execution hangs.
+
+Expected Results:
+IPHostEntry is returned or an exception thrown.
+
+How often does this happen? 
+Every time.
+
+Additional Information:  Here's a VB.NET class that can be used to 
+reproduce the problem.  I'm not sure if it will compile under Mono, but it 
+runs under Mono if compile with the MS compiler.
+
+Public Class BreakMonoDNS
+    Private _dnsLookupComplete As New System.Threading.ManualResetEvent
+(False)
+
+    Public Sub DontBreakIt()
+        System.Console.WriteLine("before resolve")
+        Dim ip As System.Net.IPHostEntry = System.Net.Dns.Resolve("www.go-
+mono.org")
+        System.Console.WriteLine("done with resolve for " & ip.HostName)
+        System.Console.WriteLine(ip.AddressList.Length & " addresses 
+found")
+    End Sub
+
+    Public Sub BreakItWithResolve()
+        _dnsLookupComplete.Reset()
+        System.Console.WriteLine("starting resolve")
+        System.Net.Dns.BeginResolve("winfessor.com", AddressOf resolvecb, 
+Nothing)
+        If Not _dnsLookupComplete.WaitOne(10000, True) Then
+            System.Console.WriteLine("timeout occurred")
+        End If
+
+    End Sub
+
+    Public Sub BreakItWithGetHostByName()
+        _dnsLookupComplete.Reset()
+        System.Console.WriteLine("starting hostbyname")
+        System.Net.Dns.BeginGetHostByName("winfessor.com", AddressOf 
+hostbynamecb, Nothing)
+        If Not _dnsLookupComplete.WaitOne(10000, True) Then
+            System.Console.WriteLine("timeout occurred")
+        End If
+    End Sub
+
+    Private Sub hostbynamecb(ByVal ar As IAsyncResult)
+        System.Console.WriteLine("inside callback")
+        Dim result As System.Net.IPHostEntry = 
+System.Net.Dns.EndGetHostByName(ar)
+        System.Console.WriteLine("after endgethostbyname")
+        _dnsLookupComplete.Set()
+    End Sub
+
+    Private Sub resolvecb(ByVal ar As IAsyncResult)
+        System.Console.WriteLine("inside callback")
+        Dim result As System.Net.IPHostEntry = System.Net.Dns.EndResolve
+(ar)
+        System.Console.WriteLine("after endresolve")
+        _dnsLookupComplete.Set()
+    End Sub
+End Class