cron icon indicating copy to clipboard operation
cron copied to clipboard

The leap second caused a scheduled job to run twice

Open bdesham opened this issue 7 years ago • 4 comments

I have a job that is scheduled to run at 0 0 1 * *, i.e. at midnight at the beginning of each month. This worked as expected until this past January 1, when the job ran twice. PostgreSQL reports that the task ran at the following times:

  • 2016-12-31 23:59:59.070603+00
  • 2017-01-01 00:00:00.006794+00

For comparison, the most recent normal run happened at 2016-12-01 00:00:00.006968+00.

I assume that the culprit was the leap second that was inserted at the end of 2016-12-31: there was a 23:59:60 on that day.

This happened under Ubuntu 14.04.5. The machine uses NTP (with, I believe, whatever the default Ubuntu configuration is) to keep its time in sync.

bdesham avatar Jan 09 '17 19:01 bdesham

At least for chrony this behavior is actually configurable - see https://chrony.tuxfamily.org/doc/2.4/chrony.conf.html#leapsecmode

sorki avatar Jul 12 '18 04:07 sorki

Is chrony related to this cron library somehow, or are you just pointing out a possible future feature? 🙂

bdesham avatar Jul 12 '18 17:07 bdesham

Not really - I'm just trying to point out that the behavior of step seconds is configurable in NTP daemon. Chronyd is just a replacement for NTPD which I'm very happy with for a long time.

sorki avatar Jul 16 '18 08:07 sorki

BTW there's no chance I'm going to work on this bug fix any time soon but I'd be happy to take a PR.

MichaelXavier avatar Jul 16 '18 15:07 MichaelXavier