[vlc-devel] Re: getaddrinfo stuck when using nonexistent domain suffix

Rémi Denis-Courmont rdenis at simphalempin.com
Wed Nov 1 08:32:51 CET 2006


On Wed, Nov 01, 2006 at 05:53:39AM +0200, Falck Kenneth wrote :
> We're using VLC on WinXP for multicast playback of style IPv4
> addresses, and it sometimes gets stuck for ~15 sec when opening a
> stream.

That's another variant of a known Windows bug :(

> Apparently this is caused by getaddrinfo(), which tries to resolve
> addresses like for AAAA records. (The
> internal domain suffix comes from our Windows domain setup.

Blame Winsock for its braindead implementation of getaddrinfo!

I actually wonder why this hadn't been fixed in so many years though.

> The delay only happens when the internal DNS server is unavailable,
> i.e. when an office laptop is connected directly to the Internet.)

Well, I would expect some problem if the DNS server is misconfigured.

But in fact, it's even worse since Windows also pauses 2 seconds before
returning from its internal DNS resolver, even if the DNS server
sends a proper error response (and similarly, it times out doing a TCP
connection even if it receives a TCP/RST). Winsock is just plain broken,
and it's been so for more than 10 years.

> A possible fix would be to call getaddrinfo() first with AI_NUMERICHOST
> to check if the playback address is numeric, and use the returned
> address if it is. If not, it would be called again with default options
> to resolve any DNS names.

Yes, that might work.

> After reading the getaddrinfo() docs and RFCs it seems that they make no
> guarantee of NOT trying to resolve n.n.n.n addresses from DNS in the
> IPv6 family context. So the only reliable solution is either to limit
> queries to IPv4 or use AI_NUMERICHOST first.

I think the relevant specification try to avoid being specific about any
addresses family. But that's kind of common sense. And so is having a
properly configured DNS server.

> Do you have any comments? This would seem to be potential problem for
> any Windows users that are using domains with internal DNS.

It's actually a problem for anybody using Windows.

> PS. Things work fine when using --ipv4, which forces the AF_INET hint
> for getaddrinfo(). But it seems like a workaround to do it manually.

Yup. The opposite is also true (it tries to resolve IPv6 numerical
addresses as IPv4 DNS entries, which is even more dumb as no DNS name
contains ':' in real life).


Rémi Denis-Courmont
Otaniemi, Espoo, Finland
looking for a job

This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html

More information about the vlc-devel mailing list