João Freitas

The following is a question-answer on examples of programs that highly depend on time values and may be affected if an abnormal time jump is noticed.


The chrony documentation warns

BE WARNED: Certain software will be seriously affected by such jumps in the system time. (That is the reason why chronyd uses slewing normally.) Documentation

But the documentation gives no examples. What are examples of software that will be seriously affected? Is the OS or any background processes at risk?


This is a bit of open question but let me give some examples:


I recently got bit by a bug that dates back to 1999 and affects both the JVM and Android Runtime:

… two extra executions are fired (unexpectedly) when the system clock is set ahead one minute after the task is scheduled using scheduleAtFixedRate().

I work on a device that starts with the 1970 epoch as the current time, then receives the correct network time a little later. Occasionally a 3rd party library would initialize before the time was set, causing it to experience a 50 year time jump.

The result was scheduleAtFixedRate attempting to catch up on ~50 years worth of invocations… which was about 27 million back-to-back invocations with no delay between them.

That would cause the GC to go haywire and generally bog down the system until it was restarted

#reads #stack overflow #romeo ninov #unix #linux #real-time #chrony