[Mono-dev] Async DNS resolution bug -- throws unhandled exception

Alex Chudnovsky alexc at majestic12.co.uk
Sat Sep 3 14:10:56 EDT 2005


Hi all,

I have come across with the following bug on Mono v1.1.7 run under 
Linux: when I use asyncronous DNS resolution and domain name is not 
found, then I get normal exception, however after that a new exception 
is thrown from inside of core library and it falls into global unhandled 
exceptions handler -- its as if this known exception is not suppressed 
in the callback, which it is. I have attached C# sample that I used to 
reproduce this error. Here are text outputs from different OSes:

Under Linux:

------------------------------------------------------------------------------------------------
About to start resolving fv7ov41hycwpjyec3p.cywater.com

AsyncDNSResolved() exception: System.Net.Sockets.SocketException: No 
such host is known
in <0x0009f> System.Net.Dns:GetHostByName (System.String hostName)
in <0x00066> System.Net.Dns:Resolve (System.String hostName)
in (wrapper delegate-invoke) 
System.MulticastDelegate:invoke_IPHostEntry_string (string)

BUG -- UNHANDLED EXCEPTION: System.Net.Sockets.SocketException: No such 
host is known
in <0x0009f> System.Net.Dns:GetHostByName (System.String hostName)
in <0x00066> System.Net.Dns:Resolve (System.String hostName)
in (wrapper delegate-invoke) 
System.MulticastDelegate:invoke_IPHostEntry_string (string)
------------------------------------------------------------------------------------------------

Note that second exception is exactly the same as the first -- it is 
caught by unhandled exceptions handler.

here is what I get under windows using both Mono and native .NET 1.1:

----------------------------------------------------------------------------
About to start resolving fv7ov41hycwpjyec3p.cywater.com

AsyncDNSResolved() exception: System.Net.Sockets.SocketException: The 
requested
name is valid and was found in the database, but it does not have the 
correct as
sociated data being resolved for

Server stack trace:
   at System.Net.Dns.GetHostByName(String hostName)
   at System.Net.Dns.Resolve(String hostName)
   at 
System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(MethodBase 
mb, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInC
ontext, Object[]& outArgs)  at 
System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMe
ssage msg, IMessageSink replySink)

Exception rethrown at [0]:
   at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message 
reqMsg,Boolean bProxyCase)
   at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object 
NotUsed, MessageData& msgData)
   at System.Net.ResolveDelegate.EndInvoke(IAsyncResult result)
   at System.Net.Dns.EndResolve(IAsyncResult asyncResult)
   at Majestic12.MonoDnsBug.AsyncDNSResolved(IAsyncResult oAR) in 
h:\alex\projects\tests\monodnsbug\monodnsbug.cs:line 59
----------------------------------------------------------------------------

As you can see there is no additional exception that has to be caught by 
the UNHANDLED exception handler.

I think this is because exception handled by the asyncronoous call back 
routine is rethrown again by the library.

Any comments would be appreciated.

Alex


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: MonoDnsBug.cs
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050903/870e124f/attachment.pl 


More information about the Mono-devel-list mailing list