| Summary: | gettimeofday() returns negative value | ||
|---|---|---|---|
| Product: | Base System | Reporter: | Riccardo Torrini <riccardo> |
| Component: | kern | Assignee: | freebsd-bugs (Nobody) <bugs> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | 3.3-STABLE | ||
| Hardware: | Any | ||
| OS: | Any | ||
I have run the program for many hours and cannot produce the error. I am using 3.2 release on a K6-2 and a Pentium. Have you tried it on a different PC or version of FreeBSD? How frequently does it produce the error? I have noticed you have a lot of equipment installed, could one of these be affecting some part of memory? have you tried bringing the system up with various parts disabled then running the test? pn. State Changed From-To: open->closed Jason K. Fritcher <jkf@wolfnet.org> reports that the problem was likely caused by a flaky hardware and has been fixed with a combination of setting the kern.timecounter.method to 1 and adding an 'options NTIMECOUNTER=10' to the kernel config. |
gettimeofday() sometimes returns negative values for microseconds. Already submitted as PR misc/13992 (routed exit after some day of work with signal 6, core dump). Fix: I have work-around with a script that poll processes and respawn "routed -s" when it dies. Not a real fix... :-( How-To-Repeat: -----8<-----[ gettimeofday_test.c ]-----8<----- #include <sys/time.h> #include <err.h> #include <stdio.h> void main() { struct timeval tp; do { if (gettimeofday(&tp, (struct timezone *)NULL) == -1) { err(1, "gettimeofday"); } if (tp.tv_usec < 0) { errx(1, "invalid time returned: %ld:%ld", tp.tv_sec, tp.tv_usec); } } while (1); } =====[ output on my machine ]===== After about 20minutes: gettimeofday_test: invalid time returned: 938527821:-695331771 # sysctl kern.timecounter.method machdep.i8254_freq kern.timecounter.method: 0 machdep.i8254_freq: 1193182