Description of problem:
Threaded program crashes with multiple concurrent getservbyname_r()
calls on NIS boxes.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Build test program (will attach shortly)
2. Execute test program
Threads each call getservbyname_r() consecutively for a number of
times, then after 30 seconds the program exits.
I could only reproduce this on RHEL3 when bound to a NIS domain,
RHEL2.1 and FC2 don't show this behaviour.
Created attachment 100080 [details]
Test program, compile with:
gcc -o main main.c -lpthread
The program opens a number of threads which each consecutively call
getservbyname_r() for a nonexisting service "gurus" (just an example) a number
of times (200 in the attached test program).
Are you able to reproduce this with glibc-2.3.2-95.20
There have been a bunch of fixes in exactly this part of the NIS
Yes, I got the SIGSEGV with 2.3.2-95.20 as well.
Wonder why you haven't seen it on FC2, wasn't it UP and a bit of sheer
Created attachment 102278 [details]
Different test program which shows the problem on FC2 as well
Another test program which shows the problem on FC2 as well, courtesy of
Fabrizio Muscarella, refined by me. Simply untar and make. Builds
nis_tst_getservbyname_r and nis_tst_getaddrinfo which use getservbyname_r() or
Can you reproduce it with glibc-2.3.3-31 or later though (rawhide/FC3t1)?
Ping!? I cannot reproduce any problem with glibc-2.3.3-45.i686.
The program prints
Oops... (Servname not supported for ai_socktype)
Oops indeed, will check when I have access to an FC3 box later in the day.
the output 'Oops...' is printed only by the second test program if you
compile it without USE_GETSERVBYNAME_R (bacause i forgot to check the
return value of getservbyname_r , mmmmm ;-( ). In this case will be
interesting to known if getservbyname_r is working too.
I see no failures with a current glibc version in neither versions of
the program in the second patch. I mark the bug as fixed. If you
still see failures, please reopen with appropriate instructions to