[Python-Dev] Re: Re: mysterious hangs in socket code

Martin v. Loewis martin@v.loewis.de
21 Sep 2002 00:38:18 +0200

Mats Wichmann <mats@laplaza.org> writes:

>  >I think that part is already settled: getaddrinfo, on Linux, is
>  >thread-safe.
> The latest Posix/Single UNIX spec in fact require getaddrinfo
> (and getnameinfo) to be thread-safe.

Yes, but this doesn't stop *BSD from providing a getaddrinfo
implementation that is not thread-safe - they merely document that
limitation on the man page.

> Gives me a headache, too, especially once it vectors off into
> the glibc nss code.  These routines (__gethostbyname2_r is the
> likely suspect, __gethostbyaddr_r and __getservbyname_r might
> also get called) do have paths that could twiddle a glibc internal
> lock so it's not impossible there's an issue here, although at
> something less than a term-paper-depth look it doesn't SEEM like
> it should ever be able to block for very long.

I'd recommend to use strace for further analysis, perhaps using it's
-r option.