Date: Fri, 7 Apr 2000 12:42:59 +0200 From: kees@echelon.nl (Kees Hendrikse) To: FreeBSD-gnats-submit@freebsd.org Subject: kern/17842: Erratic user time reports for long running processes Message-ID: <E12dWE7-0000Bg-00@Proxy.BTC-Twente.nl>
next in thread | raw e-mail | index | archive | help
>Number: 17842 >Category: kern >Synopsis: Erratic user time reports for long running processes >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Apr 7 03:50:01 PDT 2000 >Closed-Date: >Last-Modified: >Originator: Kees Hendrikse >Release: FreeBSD 3.4-RELEASE i386 >Organization: Echelon Consultancy bv, Enschede, Netherlands >Environment: Tested on a stock 3.4-RELEASE, also tested on a stock 2.2.6-RELEASE. Probably a bug present in all releases of FreeBSD. >Description: After a process has consumed more than (about) 379400 seconds of user time, ru.ru_utime.tv_sec rolls over to 0. After that, the counter is updated with twice the amount of time actually spent in user mode. The small program below shows this behaviour, after running for a couple of days: ce=379950 cu=378871 ce=380079 cu=378999 ce=380207 cu=379127 ce=380336 cu=379255 ce=380464 cu=379384 ANOMALY: st=954617438 pe=380464 ce=380592 pu=379384 cu=237 ANOMALY: st=954617438 pe=380592 ce=380721 pu=237 cu=493 ANOMALY: st=954617438 pe=380721 ce=380849 pu=493 cu=749 ANOMALY: st=954617438 pe=380849 ce=380978 pu=749 cu=1005 ANOMALY: st=954617438 pe=380978 ce=381106 pu=1005 cu=1260 ANOMALY: st=954617438 pe=381106 ce=381234 pu=1260 cu=1516 ANOMALY: st=954617438 pe=381234 ce=381363 pu=1516 cu=1772 ANOMALY: st=954617438 pe=381363 ce=381491 pu=1772 cu=2027 The same erratic numbers are reported via /proc/PID/status. This bug effects long running programs that consume lots of CPU time and use ru.ru_utime for internal statistics. For example, it causes the setiathome client to return results with negative amounts of CPU time spent, causing the results to be rejected. >How-To-Repeat: Run this program for more than 105 hours (with nice -20): /* pointless.c */ #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/time.h> #include <sys/resource.h> main() { struct rusage ru; struct timeval tv; struct timezone tz; clock_t start, pelap, celap, puser, cuser; long i; srandomdev(); gettimeofday(&tv, &tz); getrusage(0, &ru); start = tv.tv_sec; celap = 0; cuser = ru.ru_utime.tv_sec; while (1) { for (i=0; i < 100000000; i++) random(); gettimeofday(&tv, &tz); getrusage(0, &ru); pelap = celap; celap = tv.tv_sec - start; puser = cuser; cuser = ru.ru_utime.tv_sec; if (celap < pelap || cuser < puser || cuser - puser > celap - pelap + 1) fprintf(stderr, "ANOMALY: st=%ld pe=%ld ce=%ld pu=%ld cu=%ld\n", start, pelap, celap, puser, cuser); else fprintf(stderr, "ce=%ld cu=%ld\n", celap, cuser); } } >Fix: >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E12dWE7-0000Bg-00>