sanjaysgh / jabber-net

Automatically exported from code.google.com/p/jabber-net
Other
0 stars 0 forks source link

DNS SRV lookups fail on a 64bit machine with >32bit address space (A connection attempt failed because ...) #141

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
  1. Attempt to use the jabber client on a 64bit Windows machine with lots of memory.

What is the expected output? What do you see instead?

    The SRV lookup crashes with an overflow exception. This exception is caught and the fallback behaviour is to use the A record for the domain (which means the xmpp client fails with a connection timeout).

   The stack trace looks like:

   Full exception : netlib.Dns.DnsException: unspecified error ---> System.OverflowException: Arithmetic operation resulted in an overflow.
     at System.IntPtr.ToInt32()
     at netlib.Dns.DnsRequest.GetData(IntPtr ptr, DnsRecord& dnsrec, Object& Data)
     at netlib.Dns.DnsRequest.GetResponse(DnsRecordType dnstype)

What version of the product are you using? On what operating system?

   Windows Server 2012 R2

Please provide any additional information below.

   The failing pointer arithemtic is here:
      http://code.google.com/p/jabber-net/source/browse/trunk/netlib.Dns/dns.cs?r=580#1523

   The code should use a 64bit variable, so that the pointer arithmetic isn't truncated. e.g.

      long size = ptr.ToInt64() + Marshal.SizeOf( dnsrec );

Reported error

Full exception : System.Net.Sockets.SocketException (0x80004005): A connection 
attempt failed because the connected party did not properly respond after a 
period of time, or established connection failed because connected host has 
failed to respond 11.90.138.30:5222
   at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
   at bedrock.net.AsyncSocket.ExecuteConnect(IAsyncResult ar)

Original issue reported on code.google.com by gregbrac...@gmail.com on 25 Mar 2014 at 5:21