Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Feb 2004 03:21:58 -0800 (PST)
From:      "Jukka A. Ukkonen" <jau@iki.fi>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/62524: SIGALRM is not delivered when res_send() hangs waiting in kevent()
Message-ID:  <200402081121.i18BLwEl037903@www.freebsd.org>
Resent-Message-ID: <200402081130.i18BUKx3052846@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         62524
>Category:       kern
>Synopsis:       SIGALRM is not delivered when res_send() hangs waiting in kevent()
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Feb 08 03:30:20 PST 2004
>Closed-Date:
>Last-Modified:
>Originator:     Jukka A. Ukkonen
>Release:        4.9-STABLE
>Organization:
>Environment:
FreeBSD mjolnir 4.9-STABLE FreeBSD 4.9-STABLE #0: Sun Jan 25 10:05:58 EET 2004     jau@mjolnir.XXXXXXXXXXX:/usr/src/sys/compile/Mjolnir  i386
>Description:
When an interval timer should trigger a SIGALRM delivery to
a process which tries to resolve an address to an FQDN and
there is no name service available for the corresponding
in-addr.arpa. domain the signal is not delivered.

Instead the process simply hangs waiting in ...

#0  0x280b3c00 in kevent () from /usr/lib/libc.so.4
#1  0x280c63f5 in res_send () from /usr/lib/libc.so.4
#2  0x280c9799 in res_query () from /usr/lib/libc.so.4
#3  0x280d5ccf in _gethostbydnsaddr () from /usr/lib/libc.so.4
#4  0x280d45f0 in gethostbyaddr () from /usr/lib/libc.so.4

The process continues only when the resolver timeout expires.

This is a disaster for any program which uses setitimer() and
SIGALRM to drive periodic tasks at regular intervals.

It looks like kevent() is not properly interrupted by the signal.

>How-To-Repeat:
      Call setitimer() to set the timer to trigger SIGARLM at say
5 second intervals. Actually anything relatively short should be OK
as long as it is shorter than your default resolver timeout.

Now call gethostbyaddr() with an address for which the reverse DNS
server is not available.
Before testing make sure the registered reverse DNS server is
unavailable...

# dig -x 63.85.29.224
; <<>> DiG 9.2.1 <<>> -x 63.85.29.224
;; global options:  printcmd
;; connection timed out; no servers could be reached

Now launch your SIGALRM delivery test.
You will end up waiting in kevent() until the resolver timeout
expires instead of receiving the expected SIGALRM.

>Fix:
      None known yet.
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200402081121.i18BLwEl037903>