linuxpthreadsleap-second

Leap Seconds and pthread_mutex_timedlock premature timeout


So just recently, my async server code which relies on pthread_mutex_timedlock seem to have timed out prematurely. I thought it was just my bug at first, but seeing that there was some leap seconds issues with the linux kernel, it seems that I'm not the only one: https://lkml.org/lkml/2012/7/1/11

What is the current fix for this? Restart the server, or update kernel? My server's relying on the timedlock mechanism to wait for events from other threads, and with this premature timeout, the CPU usage has been at 100% because it never rests at the timed lock.

I'm currently running ubuntu server 10.04.4, with kernel version 2.6.39.1


Solution

  • Well, I came across http://forums.pentaho.com/showthread.php?98217-Java-leap-second-bug-how-to-fix-your-broken-servers&s=5836d11a51327406f965c66fddc9149d&p=286479#post286479

    And this under sudo did the trick:

    /etc/init.d/ntp stop; date; date `date +"%m%d%H%M%C%y.%S"`; date; /etc/init.d/ntp start
    

    (#kernel at freenode says date -s "\date\" fixes it)

    Which was also confirmed by the drop in CPU usage from right around 100% to 0.5%. So I guess that's that, until the next leap second insertion.