bug in job_process_catch_runaway when clock moves backward?
Casey Dahlin
cdahlin at redhat.com
Thu Mar 26 18:23:28 GMT 2009
upstart at eehouse.org wrote:
> 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
I'd second that the CLOCK_MONOTONIC fix is right for this case. While we're here we should probably screen for any other time related issues like this that might come up.
Also, you neglected to mention what version you found this in :)
--CJD
More information about the upstart-devel
mailing list