Bug#490530: libc6: gethostbyaddr() times out if reverse dns not found

View: New views
5 Messages — Rating Filter:   Alert me  

Bug#490530: libc6: gethostbyaddr() times out if reverse dns not found

by Thue Janus Kristensen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Package: libc6
Version: 2.7-10
Severity: normal


I noticed that when I tried pinging kalus.dk (which does not have
reverse DNS at the time of writing), ping would only send a packet
every 5 seconds.

R@h ~> host kalus.dk
kalus.dk has address 89.233.27.15
kalus.dk mail is handled by 10 mail.kalus.dk.
R@h ~> host 89.233.27.15
Host 15.27.233.89.in-addr.arpa. not found: 3(NXDOMAIN)
R@h ~> ping kalus.dk
PING kalus.dk (89.233.27.15) 56(84) bytes of data.
[5 second pause]
64 bytes from 89.233.27.15: icmp_seq=1 ttl=56 time=6.21 ms
[5 second pause]
64 bytes from 89.233.27.15: icmp_seq=2 ttl=56 time=5.89 ms
[5 second pause]
64 bytes from 89.233.27.15: icmp_seq=3 ttl=56 time=5.98 ms
[5 second pause]
64 bytes from 89.233.27.15: icmp_seq=4 ttl=56 time=4.48 ms

I tracked it down to the function call char *pr_addr in ping.c, when calling gethostbyaddr() :
/*  pr_addr --  Return an ascii host address as a dotted quad and optionally with a hostname. */
char *pr_addr(__u32 addr) {
        struct hostent *hp;
[...]
        hp = gethostbyaddr((char *)&addr, 4, AF_INET);
[...]
}

I see no reason why it should take 5 seconds to find out that reverse DNS is not available, when the "host" command returns the answer immediately.

Doing a strace I get (selected parts of trace):

stat("/etc/resolv.conf", {st_mode=S_IFREG|0644, st_size=131, ...}) = 0
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
connect(4, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("83.221.148.2")}, 28) = 0
fcntl(4, F_GETFL)                       = 0x2 (flags O_RDWR)
fcntl(4, F_SETFL, O_RDWR|O_NONBLOCK)    = 0
poll([{fd=4, events=POLLOUT, revents=POLLOUT}], 1, 0) = 1
sendto(4, "\t,\1\0\0\1\0\0\0\0\0\0\00215\00227\003233\00289\7in-a"..., 43, MSG_NOSIGNAL, NULL, 0) = 43
poll([{fd=4, events=POLLIN, revents=POLLIN}], 1, 5000) = 1
ioctl(4, FIONREAD, [103])               = 0
recvfrom(4, "\t,\201\203\0\1\0\0\0\1\0\0\00215\00227\003233\00289\7"..., 1024, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("83.221.148.2")}, [16]) = 103
close(4)                                = 0
socket(PF_FILE, SOCK_STREAM, 0)         = 4
fcntl(4, F_GETFD)                       = 0
fcntl(4, F_SETFD, FD_CLOEXEC)           = 0
connect(4, {sa_family=AF_FILE, path="/var/run/avahi-daemon/socket"}, 110) = 0
fcntl(4, F_GETFL)                       = 0x2 (flags O_RDWR)
fstat(4, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2afcdfb72000
lseek(4, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
write(4, "RESOLVE-ADDRESS 89.233.27.15\n", 29) = 29
read(4,

[***Here there is a 5 second wait***]

"-15 Timeout reached\n", 1024)  = 20
close(4)                                = 0


I noted the
lseek(4, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
Which seems suspecious.

Regards, Thue

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

Kernel: Linux 2.6.24-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_DK.UTF-8, LC_CTYPE=en_DK.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages libc6 depends on:
ii  libgcc1                       1:4.3.1-2  GCC support library

libc6 recommends no packages.

-- debconf information:
* glibc/upgrade: true
  glibc/restart-failed:
* glibc/restart-services: openbsd-inetd exim4 cupsys cron atd



--
To UNSUBSCRIBE, email to debian-bugs-dist-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Bug#490530: libc6: gethostbyaddr() times out if reverse dns not found

by Stephen Gran :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This one time, at band camp, Thue Janus Kristensen said:

> I noticed that when I tried pinging kalus.dk (which does not have
> reverse DNS at the time of writing), ping would only send a packet
> every 5 seconds.
>
> connect(4, {sa_family=AF_FILE, path="/var/run/avahi-daemon/socket"}, 110) = 0
> write(4, "RESOLVE-ADDRESS 89.233.27.15\n", 29) = 29
> read(4,
>
> [***Here there is a 5 second wait***]
>
> "-15 Timeout reached\n", 1024)  = 20
> close(4)                                = 0
Not that glibc doesn't have similar problems, but surely that's an avahi
bug?
--
 -----------------------------------------------------------------
|   ,''`.                                            Stephen Gran |
|  : :' :                                        sgran@... |
|  `. `'                        Debian user, admin, and developer |
|    `-                                     http://www.debian.org |
 -----------------------------------------------------------------


signature.asc (196 bytes) Download Attachment

Bug#490530: libc6: gethostbyaddr() times out if reverse dns not found

by Thue Janus Kristensen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes - reading the trace closer it is obviously an avahi bug.

Regards, Thue

On Sat, Jul 12, 2008 at 3:12 PM, Stephen Gran <sgran@...> wrote:
This one time, at band camp, Thue Janus Kristensen said:
> I noticed that when I tried pinging kalus.dk (which does not have
> reverse DNS at the time of writing), ping would only send a packet
> every 5 seconds.
>
> connect(4, {sa_family=AF_FILE, path="/var/run/avahi-daemon/socket"}, 110) = 0
> write(4, "RESOLVE-ADDRESS 89.233.27.15\n", 29) = 29
> read(4,
>
> [***Here there is a 5 second wait***]
>
> "-15 Timeout reached\n", 1024)  = 20
> close(4)                                = 0

Not that glibc doesn't have similar problems, but surely that's an avahi
bug?
--
 -----------------------------------------------------------------
|   ,''`.                                            Stephen Gran |
|  : :' :                                        sgran@... |
|  `. `'                        Debian user, admin, and developer |
|    `-                                     http://www.debian.org |
 -----------------------------------------------------------------

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFIeK3MSYIMHOpZA44RAi50AJ9zsnX17sRcT1inG92VuFXFAUebIQCgxP6A
U47EBFj4aH7Fbt1Lofe4lQw=
=Xkeg
-----END PGP SIGNATURE-----



Bug#490530: libc6: gethostbyaddr() times out if reverse dns not found

by Thue Janus Kristensen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I investigated further, and this is arguably not a bug. Please close it.

Regards, Thue

On Sat, Jul 12, 2008 at 3:17 PM, Thue Janus Kristensen <thuejk@...> wrote:
Yes - reading the trace closer it is obviously an avahi bug.

Regards, Thue

On Sat, Jul 12, 2008 at 3:12 PM, Stephen Gran <sgran@...> wrote:
This one time, at band camp, Thue Janus Kristensen said:
> I noticed that when I tried pinging kalus.dk (which does not have
> reverse DNS at the time of writing), ping would only send a packet
> every 5 seconds.
>
> connect(4, {sa_family=AF_FILE, path="/var/run/avahi-daemon/socket"}, 110) = 0
> write(4, "RESOLVE-ADDRESS 89.233.27.15\n", 29) = 29
> read(4,
>
> [***Here there is a 5 second wait***]
>
> "-15 Timeout reached\n", 1024)  = 20
> close(4)                                = 0

Not that glibc doesn't have similar problems, but surely that's an avahi
bug?
--
 -----------------------------------------------------------------
|   ,''`.                                            Stephen Gran |
|  : :' :                                        sgran@... |
|  `. `'                        Debian user, admin, and developer |
|    `-                                     http://www.debian.org |
 -----------------------------------------------------------------

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFIeK3MSYIMHOpZA44RAi50AJ9zsnX17sRcT1inG92VuFXFAUebIQCgxP6A
U47EBFj4aH7Fbt1Lofe4lQw=
=Xkeg
-----END PGP SIGNATURE-----




Bug#490530: marked as done (libc6: gethostbyaddr() times out if reverse dns not found)

by Debian Bug Tracking System :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Your message dated Tue, 22 Jul 2008 16:34:04 +0200
with message-id <20080722143404.GA11540@...>
and subject line Re: Bug#490530: libc6: gethostbyaddr() times out if reverse dns not found
has caused the Debian Bug report #490530,
regarding libc6: gethostbyaddr() times out if reverse dns not found
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@...
immediately.)


--
490530: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=490530
Debian Bug Tracking System
Contact owner@... with problems

Package: libc6
Version: 2.7-10
Severity: normal


I noticed that when I tried pinging kalus.dk (which does not have
reverse DNS at the time of writing), ping would only send a packet
every 5 seconds.

R@h ~> host kalus.dk
kalus.dk has address 89.233.27.15
kalus.dk mail is handled by 10 mail.kalus.dk.
R@h ~> host 89.233.27.15
Host 15.27.233.89.in-addr.arpa. not found: 3(NXDOMAIN)
R@h ~> ping kalus.dk
PING kalus.dk (89.233.27.15) 56(84) bytes of data.
[5 second pause]
64 bytes from 89.233.27.15: icmp_seq=1 ttl=56 time=6.21 ms
[5 second pause]
64 bytes from 89.233.27.15: icmp_seq=2 ttl=56 time=5.89 ms
[5 second pause]
64 bytes from 89.233.27.15: icmp_seq=3 ttl=56 time=5.98 ms
[5 second pause]
64 bytes from 89.233.27.15: icmp_seq=4 ttl=56 time=4.48 ms

I tracked it down to the function call char *pr_addr in ping.c, when calling gethostbyaddr() :
/*  pr_addr --  Return an ascii host address as a dotted quad and optionally with a hostname. */
char *pr_addr(__u32 addr) {
        struct hostent *hp;
[...]
        hp = gethostbyaddr((char *)&addr, 4, AF_INET);
[...]
}

I see no reason why it should take 5 seconds to find out that reverse DNS is not available, when the "host" command returns the answer immediately.

Doing a strace I get (selected parts of trace):

stat("/etc/resolv.conf", {st_mode=S_IFREG|0644, st_size=131, ...}) = 0
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
connect(4, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("83.221.148.2")}, 28) = 0
fcntl(4, F_GETFL)                       = 0x2 (flags O_RDWR)
fcntl(4, F_SETFL, O_RDWR|O_NONBLOCK)    = 0
poll([{fd=4, events=POLLOUT, revents=POLLOUT}], 1, 0) = 1
sendto(4, "\t,\1\0\0\1\0\0\0\0\0\0\00215\00227\003233\00289\7in-a"..., 43, MSG_NOSIGNAL, NULL, 0) = 43
poll([{fd=4, events=POLLIN, revents=POLLIN}], 1, 5000) = 1
ioctl(4, FIONREAD, [103])               = 0
recvfrom(4, "\t,\201\203\0\1\0\0\0\1\0\0\00215\00227\003233\00289\7"..., 1024, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("83.221.148.2")}, [16]) = 103
close(4)                                = 0
socket(PF_FILE, SOCK_STREAM, 0)         = 4
fcntl(4, F_GETFD)                       = 0
fcntl(4, F_SETFD, FD_CLOEXEC)           = 0
connect(4, {sa_family=AF_FILE, path="/var/run/avahi-daemon/socket"}, 110) = 0
fcntl(4, F_GETFL)                       = 0x2 (flags O_RDWR)
fstat(4, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2afcdfb72000
lseek(4, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
write(4, "RESOLVE-ADDRESS 89.233.27.15\n", 29) = 29
read(4,

[***Here there is a 5 second wait***]

"-15 Timeout reached\n", 1024)  = 20
close(4)                                = 0


I noted the
lseek(4, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
Which seems suspecious.

Regards, Thue

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

Kernel: Linux 2.6.24-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_DK.UTF-8, LC_CTYPE=en_DK.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages libc6 depends on:
ii  libgcc1                       1:4.3.1-2  GCC support library

libc6 recommends no packages.

-- debconf information:
* glibc/upgrade: true
  glibc/restart-failed:
* glibc/restart-services: openbsd-inetd exim4 cupsys cron atd



On Sat, Jul 12, 2008 at 08:04:27PM +0200, Thue Janus Kristensen wrote:
> I investigated further, and this is arguably not a bug. Please close it.

Closing it with this mail.

> Regards, Thue
>
> On Sat, Jul 12, 2008 at 3:17 PM, Thue Janus Kristensen <thuejk@...>
> wrote:
>
> > Yes - reading the trace closer it is obviously an avahi bug.
> >
> > Regards, Thue
> >
> > On Sat, Jul 12, 2008 at 3:12 PM, Stephen Gran <sgran@...> wrote:
> >
> >> This one time, at band camp, Thue Janus Kristensen said:
> >> > I noticed that when I tried pinging kalus.dk (which does not have
> >> > reverse DNS at the time of writing), ping would only send a packet
> >> > every 5 seconds.
> >> >
> >> > connect(4, {sa_family=AF_FILE, path="/var/run/avahi-daemon/socket"},
> >> 110) = 0
> >> > write(4, "RESOLVE-ADDRESS 89.233.27.15\n", 29) = 29
> >> > read(4,
> >> >
> >> > [***Here there is a 5 second wait***]
> >> >
> >> > "-15 Timeout reached\n", 1024)  = 20
> >> > close(4)                                = 0
> >>
> >> Not that glibc doesn't have similar problems, but surely that's an avahi
> >> bug?
> >> --
> >>  -----------------------------------------------------------------
> >> |   ,''`.                                            Stephen Gran |
> >> |  : :' :                                        sgran@... |
> >> |  `. `'                        Debian user, admin, and developer |
> >> |    `-                                     http://www.debian.org |
> >>  -----------------------------------------------------------------
> >>
> >> -----BEGIN PGP SIGNATURE-----
> >> Version: GnuPG v1.4.6 (GNU/Linux)
> >>
> >> iD8DBQFIeK3MSYIMHOpZA44RAi50AJ9zsnX17sRcT1inG92VuFXFAUebIQCgxP6A
> >> U47EBFj4aH7Fbt1Lofe4lQw=
> >> =Xkeg
> >> -----END PGP SIGNATURE-----
> >>
> >>
> >
--
  .''`.  Aurelien Jarno            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@...         | aurelien@...
   `-    people.debian.org/~aurel32 | www.aurel32.net

LightInTheBox - Buy quality products at wholesale price