Main Site Documentation

Possible dns lookup bug


#1

Hi.

Scenario:
I’m trying to make a dns lookup with the Dns class. That is: Dns.GetHostEntry(host). The ethernet module has DHCP enabled and gets, among others the dns server 83.255.245.11 as the first in the dns list. There seems to be a problem with this server at the moment and when trying to make a dns lookup to any url I get a query refused error back. So far so good…

The problem:
When trying to resolve an url with the Dns.GetHostEntry method to the errounous dns server I get the following error message:
#### Exception System.Net.Sockets.SocketException - CLR_E_FAIL (1) ####
#### Message:
#### Microsoft.SPOT.Net.SocketNative::getaddrinfo [IP: 0000] ####
#### System.Net.Dns::GetHostEntry [IP: 0008] ####
#### Gateway.Communication.RawHttpComm.NTPClient::LoadNTPTime [IP: 0009] ####
#### Gateway.Communication.RawHttpComm.NTPClient::GetNTPTime [IP: 0018] ####
#### Gateway.Time.TimeController::SetTime [IP: 000c] ####
#### Gateway.Program::RunFull [IP: 004a] ####
#### Gateway.Program::Main [IP: 0004] ####
#### SocketException ErrorCode = 10060
LWIP Assertion “DNS response for wrong host name” failed at line 1251 in C:\MicroFrameworkPK_v4_2\DeviceCode\GHI\pal\lwip\lwip_1 3 2\src\api\api_msg.c

The LWIP library seems to throw a correct exception since the dns server obviously don’t work but it is strange that I get a socket timeout exception. Furthermore, the Dns.GetHostEntry does not try to resolve the url with any of the other dns servers that I recieved in the DHCP handshake.

Does anyone experience this same problem?

A possible solution could perhaps be to catch SocketTimeoutExceptions from the Dsn class and set a static dns via the NetworkInterfaceClass (NetworkInterface.EnableStaticDns(“8.8.8.8”)) and then try again?

Is this a bad solution?


#2

@ ollengenic - What hardware and Firmware version?


#3

@ RobvanSchelven

Sorry… forgot to add that.

Firmware: .net mf 4.2
Hardware: G120


#4

@ ollengenic - latest firmware? SDK Package 2013 R2


#5

@ RobvanSchelven
Same problem with the new firmware.


#6

@ ollengenic - I will check in the weekend too


#7

Hmm… little response here.

As I see it, the (possible) bug makes it very unreliable to use the Dns class. In production this may force us to use a static ip instead which makes server migrations non-trivial. For us (my company) this is a major disadvantage.


#8

@ andre.m

Thanks for the help. I was thinking about writing my own resolver and these links will definitely speed up the work.

I wanted to see if anyone else has experienced the same problem (to rule out the possibility of me being stupid) before opening an issue.


#9

@ andre.m

Yes I have Ifu and I have tried to set static dns servers. However that did not work so well. When trying it at my home I still got a socket timeout. Not because the dns server did not respond (in this case I tried googles dns:s among others) but I suspect that either the response time was too long or that I got too many packet losses.