bug in job_process_catch_runaway when clock moves backward?
upstart at eehouse.org
upstart at eehouse.org
Thu Mar 26 18:10:07 GMT 2009
I've run into a what looks like a bug in job_process_catch_runaway().
It occurs when the wall clock moves backwards. If a job has been
spawned initially at some time, and the clock then moves backwards N
minutes, then in effect the respawn_interval is increased by N
minutes. If the process has to be respawned up to respawn_limit times
within that longer interval, it will never be respawned again (until
reboot.)
One fix is to test for a negative interval:
interval = time (NULL) - job->respawn_time;
if (interval >= 0 && interval < job->class->respawn_interval) {
Another would be to use clock_gettime() with CLOCK_MONOTONIC instead
of time(NULL).
Thoughts? If this is a bug, I'm happy to submit a patch. I prefer
the CLOCK_MONOTONIC fix myself.
Thanks,
--Eric
--
******************************************************************************
* From the desktop of: Eric House, xwords at eehouse.org *
* Crosswords 4.2 for MS Smartphone and PocketPC is OUT: xwords.sf.net *
******************************************************************************
More information about the upstart-devel
mailing list