MySQL Server Crashed – My Site was still online!

MySQL logoYou don’t hear this often… MySQL server crashed and the sites hosted in that server went offline for hours together. But, when a similar thing happened to my VPS, it wasn’t the case. My site was still online, while I was troubleshooting the issue with MySQL server. Ultimately, I could not figure out the issue and I had to purge the entire MySQL installation. However, I was still cool during the entire process. You may ask how. Here is what happened and how you can prevent the same for your own VPS too…

First Things First – The MySQL Logs

As part of regular tweaking of MySQL, I changed a few things in my.cnf, then restarted the mysqld. Bump! It didn’t start. I reverted the changes. Still it didn’t budge. Immediately I knew that MySQL server has crashed for unknown reason. Upon checking the log, here is what I found…

120525 06:54:11 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
120525  6:54:11 [Note] Plugin 'FEDERATED' is disabled.
06:54:11 UTC - mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.

It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 133850 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0xffffffffbfb01d80
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = ffffffffbfb03ab8 thread_stack 0x20000

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0): is an invalid pointer
Connection ID (thread ID): 0

The manual page at contains
information that should help you find out what is causing the crash.
120525 06:54:11 mysqld_safe mysqld from pid file /var/run/mysqld/ ended

I tried everything I could, for about 90 minutes. Then I gave up and purged the entire MySQL installation and installed it again. Viola! It started fine! Then it was only a matter of taking the latest database backup and putting it back.

Where is the Magic?

During this entire period, I didn’t get a single notification from Pingdom regarding my site being down. Thanks to Varnish. If you do not know already, Varnish works on top of WordPress (or any other application). So, even if your Nginx, php-fpm and MySQL server fail, your site would still be online. It works like a magic, even if the backend fails for some reason.

I wonder why web hosting companies just can’t start using Varnish ( already does, though)!

Leave a Reply

Your email address will not be published. We use cookies to prevent spam comments. Required fields are marked *