This is the mail archive of the
mailing list for the glibc project.
Is gethostbyname_r() reentrant?
- From: Petter Reinholdtsen <pere at hungry dot com>
- To: libc-alpha at sources dot redhat dot com
- Date: Mon, 12 May 2003 09:46:42 +0200
- Subject: Is gethostbyname_r() reentrant?
A few years ago, I reported PR libc/2394. The problem described is
that gethostbyname_r() isn't reentrant, and that using it from several
threads at the same time will make the DNS resolver hang.
Checking the code, it seemed that the only difference between
gethostbyname_r() function and gethostbyname() was where the result
was placed. Each thread would use the same socket when communicating
with the DNS server, and it would be hard do know wich thread would
recieve the DNS replies.
Is this still the case? I suspect each thread would need to use it's
own socket when talking with the DNS server, to make sure each thread
get the reply it is looking for.
Is the DNS resolver code changed since version 2.1.3?
My current machine is too fast for me to check if the bug is still
present. I'm unable to create enough threads. I suspect it is the
limit on process count that stops me.