[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#609527: /lib/libc.so.6: Parallel gethostbyname2_r() fails if DNS server answers the first query when receiving the second.



Package: libc6
Version: 2.11.2-6
Severity: normal
File: /lib/libc.so.6


gethostbyname2_r() will sometimes fail if it is used to look up the
same host name concurrently in two threads.  I have tested a few
variations, and if the dns server behaves in one of the following
ways, gethostbyname2_r() will work correctly:

- answers both requests immediately. 
- answers both requests in order, but delays each (so both requests are received before the first response is sent) 
- answers both requests in reverse order 
- answers only the second request (of course, the first request will fail) 
- answers only the first request but delays it, so it is sent after receiving the second request (of course the second request will fail)

Whereas the following behaviour of the dns server will cause
gethostbyname2_r() to fail:

- waits for the second request, then answers the first immediately and drops everything else.

I have verified (using wireshark) that the packets sent on the network
are as expected according to my descriptions above.

I have test code to demonstrate the issue, and I'll add it to the bug
report as soon as I get permission to do so (this may take some time).

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages libc6 depends on:
ii  libc-bin                      2.11.2-6   Embedded GNU C Library: Binaries
ii  libgcc1                       1:4.4.4-15 GCC support library

libc6 recommends no packages.

Versions of packages libc6 suggests:
ii  debconf [debconf-2.0]         1.5.35     Debian configuration management sy
pn  glibc-doc                     <none>     (no description available)
ii  locales                       2.11.2-6   Embedded GNU C Library: National L

-- debconf information:
  glibc/upgrade: true
  glibc/restart-services:
  glibc/disable-screensaver:
  glibc/restart-failed:



Reply to: