From nobody@FreeBSD.org  Thu Mar 17 20:47:52 2005
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 3A54016A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 17 Mar 2005 20:47:52 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 1F95743D49
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 17 Mar 2005 20:47:52 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j2HKlpcA043805
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 17 Mar 2005 20:47:51 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id j2HKlps4043804;
	Thu, 17 Mar 2005 20:47:51 GMT
	(envelope-from nobody)
Message-Id: <200503172047.j2HKlps4043804@www.freebsd.org>
Date: Thu, 17 Mar 2005 20:47:51 GMT
From: Jakub Kruszona-Zawadzki <acid@gemius.pl>
To: freebsd-gnats-submit@FreeBSD.org
Subject: time counter per process stops (syscall: getrusage) 
X-Send-Pr-Version: www-2.3

>Number:         78957
>Category:       kern
>Synopsis:       time counter per process stops (syscall: getrusage)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 17 20:50:02 GMT 2005
>Closed-Date:    
>Last-Modified:  Sun Jul  3 01:10:35 GMT 2005
>Originator:     Jakub Kruszona-Zawadzki
>Release:        FreeBSD 4.x - 5.x
>Organization:
Gemius SA
>Environment:
FreeBSD adnet.hit.gemius.pl 4.10-RELEASE FreeBSD 4.10-RELEASE #0: Thu Oct  7 13:48:42 CEST 2004     hitcol@adocean.hit.gemius.pl:/usr/src/sys/compile/ADNET  i386
(but it occurs on every FreeBSD 4.x and 5.x)      
>Description:
When a process is running for a long time (several days) time counter per process stops on value: 
ru_utime.tv_sec:305221
ru_utime.tv_usec:322735
>How-To-Repeat:
write something like this:

void main() {
struct rusage rus;
while (1) {
.. do something that uses the processor for a few minutes - loop with some calculations ...
getrusage(RUSAGE_SELF,&rus);
printf("ru_utime.tv_sec:%ld | ru_utime.tv_usec:%ld",rus.ru_utime.tv_sec,rus.ru_utime.tv_usec);
}
}

compile and run then wait about 305000s (about 3.5 days)
>Fix:
No idea - may be something is wrongly calculated in kernel ???
>Release-Note:
>Audit-Trail:

From: Bruce Evans <bde@zeta.org.au>
To: Jakub Kruszona-Zawadzki <acid@gemius.pl>
Cc: freebsd-gnats-submit@freebsd.org, freebsd-bugs@freebsd.org
Subject: Re: kern/78957: time counter per process stops (syscall: getrusage)
Date: Fri, 18 Mar 2005 20:06:15 +1100 (EST)

 On Thu, 17 Mar 2005, Jakub Kruszona-Zawadzki wrote:
 
 >> Description:
 > When a process is running for a long time (several days) time counter per process stops on value:
 > ru_utime.tv_sec:305221
 > ru_utime.tv_usec:322735
 
 This may be the same bug as in PR 76972.  Overflow occurs at about
 48592008 ticks = 379625 seconds = 105 hours for a a process that consumes
 100% of the CPU if the statclock frequency is 128 Hz (which is the default
 and not easy to change).  There is another overflow bug at 2^32 ticks = 388
 days.  This one is harder to fix.  See PR 76972 for details and a fix for
 the first overflow bug.
 
 37965 seconds is a little larger than 305221 seconds.  The difference might
 be due to the other 70000+ seconds being in ru_stime.
 
 The behaviour when overflow occurs is undefined, but stopping on a value
 is quite likely to occur due to the algorithm for updating ru_*time.
 Integer overflow tends to cause counters to reset to 0 (or INT_MIN),
 but the kernel enforces monotonicity of the usage times, so they will
 stick instead of going backwards to 0.
 
 Bruce

From: Bruce Evans <bde@zeta.org.au>
To: Jakub Kruszona-Zawadzki <acid@gemius.pl>
Cc: freebsd-bugs@freebsd.org
Subject: Re: kern/78957: time counter per process stops (syscall: getrusage)
Date: Fri, 18 Mar 2005 20:06:15 +1100 (EST)

 On Thu, 17 Mar 2005, Jakub Kruszona-Zawadzki wrote:
 
 >> Description:
 > When a process is running for a long time (several days) time counter per process stops on value:
 > ru_utime.tv_sec:305221
 > ru_utime.tv_usec:322735
 
 This may be the same bug as in PR 76972.  Overflow occurs at about
 48592008 ticks = 379625 seconds = 105 hours for a a process that consumes
 100% of the CPU if the statclock frequency is 128 Hz (which is the default
 and not easy to change).  There is another overflow bug at 2^32 ticks = 388
 days.  This one is harder to fix.  See PR 76972 for details and a fix for
 the first overflow bug.
 
 37965 seconds is a little larger than 305221 seconds.  The difference might
 be due to the other 70000+ seconds being in ru_stime.
 
 The behaviour when overflow occurs is undefined, but stopping on a value
 is quite likely to occur due to the algorithm for updating ru_*time.
 Integer overflow tends to cause counters to reset to 0 (or INT_MIN),
 but the kernel enforces monotonicity of the usage times, so they will
 stick instead of going backwards to 0.
 
 Bruce
 _______________________________________________
 freebsd-bugs@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
 To unsubscribe, send any mail to "freebsd-bugs-unsubscribe@freebsd.org"
 
>Unformatted:
