views:

81

answers:

1

Just wondering if anyone else has spotted this:

On some user's machines running our software, occasionally the call to Win32 winsock gethostbyname fails with error code 11004.

For the argument to gethostbyname, I'm passing in the result from gethostname.

Now the docs say 11004 is WSANO_DATA. None of the descriptions seem to be relevant (it occurs if you pass in an IP6 address, but as I say, I'm passing in a hostname).

Even more interesting is that the MSDN suggests that this combination (gethostname followed by gethostbyname) should never fail, not even if there is no IP address (in that case it would just return empty list of IPs). Here is the quote from the gethostname MSDN entry:

...it is guaranteed that the name returned will be successfully parsed by gethostbyname and WSAAsyncGetHostByName.

It only ever happens after resuming from hibernate, in that short period when the network is restarting, and only on Vista/7 (well I've only seen it on Vista and 7).

One theory I had was that it related to IP6. Maybe for a short period the network reports an IP6 address but not the corresponging IP4 address (I'm pretty sure that all the client machines are dual IP stack, but I could be wrong).

I tried to reproduce by turning off my network card (to force no IP addresses) and couldn't reproduce.

Anyone seen this before?

Any ideas?

John

+1  A: 

I think you've been bitten by an edge case.

At the end of the day doing something like hibernate is advanced stuff - restoring a PC to its exact state and continuing as if nothing had happened. Thats all well and good, but some things won't have survived, such as any network connections that expected a reply, and any seriously low-level-you-can't-set-me-only-read-me registers in the CPU.

I suggest you contact Microsoft and ask them if they know about this. If it works for other OSes they will most likely be interested in fixing it for 7/Vista. Just be prepared to hand over a binary so they can test it ad-infinitum.

Stephen Kellett
Great thanks - do you have experience of submitting bugs to MS? I've always assumed it was really painful...
John
Sorry, I don't. In my dealings with Microsoft I have found them to be an opaque organisation, very hard to deal with. Not hard as in awkward, just hard as in MS seems to reorganise teams on a regular basis and if you are a casualty of that, tough. I've had it happen to me twice. Even on the odd occasion I got the agreement from the IE team for them to provide a profiling API for IE the team was disbanded before the work could be completed. Its frustrating, I wish you all the best trying to make contact. Maybe my experience is atypical?
Stephen Kellett