This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]