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.
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!