Elementary! MySQL did it, in the CPU, with the the leap second!

I awoke to an alert from a small Ubuntu 12.04 server I have on Linode: lots of CPU usage this morning,which is odd since I haven’t logged in for a while. Hmm. Looked at the CPU graph first, and the high usage was all since exactly midnight. Hmm again.

So, I groggily log in and start looking around, and immediately see that MySQL is using LOTS of CPU all by its lonesome. I immediately wondered if somehow a hacker got in or something (given the recently reported MySQL bug) so I went to look for some hints on investigating that. On a whim (remembering the odd timing of this) I searched Google for “mysqld went to 90% cpu at midnight”. Sure enough, it’s probably a bug.

Turns out, this weekend sports a rare “leap second“… and that triggers a kernel bug which in turn causes MySQL to start eating CPU like a bad gambler at a casino buffet.

I found the following suggestion (found here and here) worked well enough for me on its own (fingers crossed anyway):

sudo date -s "`date`"  # <-- Mind the backticks!

I ran that and the problem immediately disappeared. I didn’t need to reboot or restart mysqld (rebooting would also fix it apparently, but restarting mysqld would not).

Hopefully this bit of advice serves you as well!

Share

2 Comments

  1. Massimo

    Well… thank you very much :-)
    I was looking with no success if somebody hacked my server, when I stumbled on your post.
    It fixed mysqld usage.

    Max

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>