From nobody@FreeBSD.org  Thu Jun 30 21:39:48 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CE741106564A
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 30 Jun 2011 21:39:48 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id BEBAE8FC14
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 30 Jun 2011 21:39:48 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p5ULdm9n030766
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 30 Jun 2011 21:39:48 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p5ULdm5p030765;
	Thu, 30 Jun 2011 21:39:48 GMT
	(envelope-from nobody)
Message-Id: <201106302139.p5ULdm5p030765@red.freebsd.org>
Date: Thu, 30 Jun 2011 21:39:48 GMT
From: Peter Buhr <pabuhr@uwaterloo.ca>
To: freebsd-gnats-submit@FreeBSD.org
Subject: ITIMER_REAL stops signalling
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         158541
>Category:       kern
>Synopsis:       ITIMER_REAL stops signalling (8.1-specific)
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jun 30 21:40:07 UTC 2011
>Closed-Date:    Fri Jul 01 12:10:36 UTC 2011
>Last-Modified:  Thu Jul  7 20:10:03 UTC 2011
>Originator:     Peter Buhr
>Release:        RELEASE 8.1
>Organization:
University of Waterloo
>Environment:
FreeBSD xxxx.xxx.xxx 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Mon Jul 19 02:55:53 UTC 2010 root@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
The following program stops printing; it hangs spinning in the for loop.  The
problem appears to be a missed signal for ITIMER_REAL to the program.

I have tried 4 versions of the program. Two with durations 9999 and 99999
microseconds, and two different versions to reset the time, one resets the
timer in the handler and the other uses the interval times 9999 and 99999
microseconds, respectively. All 4 versions never complete. The only conclusion
is that the kernel stops sending signals to the program.

The problem does not occur on RELEASE 8.2, so it has been fixed. Nevertheless,
I spent several hours tracking this problem down in RELEASE 8.1. After
isolating the problem, I searched the bug database and found no reference to
this problem. So it should be marked as a bug when searching the bug database
so that others do not have to discover the bug again in RELEASE 8.1.
>How-To-Repeat:
#include <stdio.h>
#include <signal.h>
#include <sys/time.h>

struct itimerval value;
int itimer_real = 1;

void alarm( int ) {
    itimer_real += 1;
//    signal( SIGALRM, alarm );
//    setitimer(ITIMER_REAL, &value, 0);
    if ( itimer_real % 10 == 0 ) printf( "%d\n", itimer_real );
}

int main() {
    value.it_value.tv_sec = 0;
    value.it_value.tv_usec = 99999;
    value.it_interval.tv_sec = 0;
    value.it_interval.tv_usec = 99999;

    signal( SIGALRM, alarm );
    setitimer( ITIMER_REAL, &value, 0 );

    for ( ; itimer_real < 1000000; );
}

// Local Variables: //
// compile-command: "g++ test.cc" //
// End: //

>Fix:


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: glebius 
State-Changed-When: Fri Jul 1 12:09:58 UTC 2011 
State-Changed-Why:  
Thanks for your report. However, if a bug is fixed in 8.2, then this PR should be closed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=158541 

From: "Peter A. Buhr" <pabuhr@plg2.math.uwaterloo.ca>
To: bug-followup@FreeBSD.org, pabuhr@uwaterloo.ca
Cc: glebius@FreeBSD.org
Subject: Re: kern/158541: ITIMER_REAL stops signalling (8.1-specific)
Date: Thu, 7 Jul 2011 15:49:16 -0400

    Thanks for your report. However, if a bug is fixed in 8.2, then this PR
    should be closed.
 
    http://www.freebsd.org/cgi/query-pr.cgi?pr=158541
 
 I cannot *confirm* the bug is fixed in 8.2, only that my example program, which
 fails quickly in 8.1, does not failed after an hour of running on 8.2. It would
 be better to have confirmation the bug was found and actually fixed.
>Unformatted:
