[reSIProcate] unresponsive DNS query blocks stack thread if USE_IPV6 is not defined (windows)

Kennard White kennard_white at logitech.com
Wed Nov 10 15:10:25 CST 2010


Hey guys,

I think I figured out why the code was setup for blocking under linux. There
is a bug in the linux implementation of ares make_socket_non_blocking(). The
line:
               if (fcntl(s, F_GETFL, &flags) == -1)
should be:
               if ( (flags  = fcntl( fd, F_GETFL, 0)) == -1 )

Reference rutil/Socket.cxx for comparison. (Though that function is missing
the error checking).

Because of above bug, the set to nonblocking would fail under linux. Someone
must have worked around this by getting rid of the nonblocking completely.

I didn't include patch since one-line fix.

Thanks,
Kennard

On Mon, Nov 1, 2010 at 7:34 AM, Justin Matthews <jmatthewsr at gmail.com>wrote:

> Updated ares_process.c to set UDP sockets non-blocking for build
> configurations where they were previously blocking:
>
>
>
> ·         Windows where USE_IPV6 was not defined
>
> ·         All non-windows builds
>
>
>
> -justin
>
>
>
> *From:* slgodin at gmail.com [mailto:slgodin at gmail.com] *On Behalf Of *Scott
> Godin
> *Sent:* Friday, October 29, 2010 8:05 PM
> *To:* Justin Matthews
> *Cc:* resiprocate-devel
> *Subject:* Re: [reSIProcate] unresponsive DNS query blocks stack thread if
> USE_IPV6 is not defined (windows)
>
>
>
> After a quick look, seems odd to me as well.  Also if non-windows we never
> set the UDP socket to non-blocking.  What I don't get is why people on linux
> have not noticed a blocking problem yet.  TCP DNS sockets seem to be set as
> non-blocking properly for linux and windows both with and without the
> USE_IPV6 directive.
>
>
>
> Scott
>
> On Fri, Oct 29, 2010 at 10:52 AM, Justin Matthews <jmatthewsr at gmail.com>
> wrote:
>
> Hi,
>
> Does anyone know if it's intended behavior for the ares UDP socket to block
> if USE_IPV6 is not defined (Windows OS)?  In ares_process.c ,
> open_udp_socket() will set the socket non-blocking only if USE_IPV6 is
> defined.  If DNS is misconfigured or there is no response for a DNS record
> lookup, the resip stack thread will block indefinitely in the recv() call
> in
> read_udp_packets().
>
> Thanks,
>
> -justin
>
> _______________________________________________
> resiprocate-devel mailing list
> resiprocate-devel at resiprocate.org
> https://list.resiprocate.org/mailman/listinfo/resiprocate-devel
>
>
>
> _______________________________________________
> resiprocate-devel mailing list
> resiprocate-devel at resiprocate.org
> https://list.resiprocate.org/mailman/listinfo/resiprocate-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20101110/7f0cf0ff/attachment.htm>


More information about the resiprocate-devel mailing list