Libraries and Applications do not account for the Leap Second
Environment
- Red Hat Enterprise Linux 4
- Red Hat Enterprise Linux 5
- Red Hat Enterprise Linux 6
- Red Hat Enterprise Linux 7
Issue
- Libraries, such as python and other code bases, and third party applications do not account for the leap second.
Resolution
- This issue must be addressed on a case by case basis depending on library or application in use. For example, in an application that calculates time deltas ensure that a negative value is considered for cases where the leap second be inserted. In the event that there is an error the application vendor responsible should be contacted to address these, as Red Hat has no control over third party applications.
Workarounds: Note that each application may have specific workarounds outside of the ones below; however, these will need to be discussed with the application vendor. The following list should prevent many issues in third party applications:
- Run
ntpin slew mode during the leap second, as documented in What does "ntpd -x" mean? Can I run NTP in slewmode?. - Disable
ntpthe day prior to the leap second and wait for the event to have passed. After this point shut down the application, restartntp, and then restart the application after the leap second has been inserted. This is not recommended as system time will not be synchronized
Root Cause
- The leap second was not considered when performing time calculations.
Diagnostic Steps
- The following traceback is seen in python applications:
Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: second must be in 0..59
Product(s)
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.