Question
Unsolveable epic MySQL crashes with Wordpress
Hi everybody, sorry about the dramatic title, but I’m truly desperate about an issue in my droplet with LAMP and Wordpress installed that seems to be really unsolveable.
It started in the beginning of 2014, when I tried to access my blog I got an “Error Establishing a Database Connection
”. I searched on Google and here in Digital Ocean community and I found a lot of tutorials and fix strategies.
Basically, something happens on Apache that makes it overload MySQL (as I imagine). Once MySQL can’t allocate enough RAM to do whatever Apache wants, it crashes and my blog stays unavailable.
Well, I used to have a 500MB droplet (the cheapest one), and the first try was on the [swap files](http:// https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-12-04). It apparently solved the problem and the blog stayed online for one week without crashing. And then, suddenly, it started again. It started crashing and even when I restarted it all, it crashed again. In this week I had no traffic changes and no new posts/new plugins. Nothing changed on my blog.
A couple of weeks later, I tried a lot of possible solutions, like this and this. I tried also a tunning in MySQL. Nothing helped.
I tried playing with max_connections
, thread_cache_size
and other MySQL config params… nothing helped. After two months of daily tries, I quit and opened a ticket at Digital Ocean. The only answer? You have to upgrade your droplet for a 1GB droplet. I wasn’t believing it was that because how can a droplet without no traffic and only a few posts could demand a 1GB droplet? But I had nothing else to try and I upgraded.
The Wordpress stayed alive for two weeks! Yay! That was the solution, right!? No! It started again with the exactly same error (I’ll show the logs on the end of this post).
For the last tries, I installed Wordpress W3 Cache and some plugins to relieve MySQL calls. It wasn’t the solution neither.
Now I’m lost and have anything else to do. I won’t upgrade to a 2GB RAM because the traffic and the number os posts on my blog didn’t increase. What I did yesterday? I created a script in a crontab to restart MySQL and Apache each 15 minutes. I know it’s the ugliest thing to do, but I think this problem won’t solve.
Wanna know the good news? IT DIDN’T SOLVE ALSO! LOL! MySQL keeps crashing and doesn’t come back even with a script doing exactly the steps I do to restart MySQL and Apache2.
So, I believe you understand why I’m desperate, right? Sorry about this long testimonial, but now that I have nothing to work on my blog, since it doesn’t work, I have a lot of free time to write.
Here are the logs on Apache2 and MySQL:
Apache2
[Sun Aug 24 08:42:05 2014] [notice] child pid 17841 exit signal Segmentation fault (11)
[Sun Aug 24 08:42:11 2014] [error] (12)Cannot allocate memory: fork: Unable to fork new process
[Sun Aug 24 08:46:48 2014] [error] (12)Cannot allocate memory: fork: Unable to fork new process
[Sun Aug 24 08:46:59 2014] [notice] child pid 17900 exit signal Segmentation fault (11)
[Sun Aug 24 08:48:36 2014] [error] (12)Cannot allocate memory: fork: Unable to fork new process
[Sun Aug 24 08:48:57 2014] [error] (12)Cannot allocate memory: fork: Unable to fork new process
[Sun Aug 24 08:49:07 2014] [notice] child pid 17927 exit signal Segmentation fault (11)
[Sun Aug 24 08:49:07 2014] [notice] child pid 17928 exit signal Segmentation fault (11)
[Sun Aug 24 08:49:07 2014] [notice] child pid 17929 exit signal Segmentation fault (11)
[Sun Aug 24 08:49:07 2014] [notice] child pid 17930 exit signal Segmentation fault (11)
[Sun Aug 24 08:55:15 2014] [error] (12)Cannot allocate memory: fork: Unable to fork new process
[Sun Aug 24 08:55:42 2014] [notice] child pid 18022 exit signal Segmentation fault (11)
[Sun Aug 24 08:56:01 2014] [error] (12)Cannot allocate memory: fork: Unable to fork new process
MySQL
140824 9:06:10 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
140824 9:06:10 [Note] Plugin 'FEDERATED' is disabled.
140824 9:06:10 InnoDB: The InnoDB memory heap is disabled
140824 9:06:10 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140824 9:06:10 InnoDB: Compressed tables use zlib 1.2.3.4
140824 9:06:10 InnoDB: Initializing buffer pool, size = 64.0M
InnoDB: mmap(68681728 bytes) failed; errno 12
140824 9:06:10 InnoDB: Completed initialization of buffer pool
140824 9:06:10 InnoDB: Fatal error: cannot allocate memory for the buffer pool
140824 9:06:10 [ERROR] Plugin 'InnoDB' init function returned error.
140824 9:06:10 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140824 9:06:10 [ERROR] Unknown/unsupported storage engine: InnoDB
140824 9:06:10 [ERROR] Aborting
140824 9:06:10 [Note] /usr/sbin/mysqld: Shutdown complete
140824 9:06:10 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
140824 9:06:10 [Note] Plugin 'FEDERATED' is disabled.
140824 9:06:10 InnoDB: The InnoDB memory heap is disabled
140824 9:06:10 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140824 9:06:10 InnoDB: Compressed tables use zlib 1.2.3.4
140824 9:06:10 InnoDB: Initializing buffer pool, size = 64.0M
InnoDB: mmap(68681728 bytes) failed; errno 12
140824 9:06:10 InnoDB: Completed initialization of buffer pool
140824 9:06:10 InnoDB: Fatal error: cannot allocate memory for the buffer pool
140824 9:06:10 [ERROR] Plugin 'InnoDB' init function returned error.
140824 9:06:10 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140824 9:06:10 [ERROR] Unknown/unsupported storage engine: InnoDB
140824 9:06:10 [ERROR] Aborting
140824 9:06:10 [Note] /usr/sbin/mysqld: Shutdown complete
Thank you.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×
This is low memory problem. Try to add big swap file - 1024MB.
I have exactly same problem with same configuration. Current request per day per site is ~40 req. So I wonder what need more memory.
I upgraded to a 2gb droplet and set up a 1024mb virtual memory, I’m running low volume websites.
The problem disappeared after upgrading last year, but has now happened twice this week.
exact same problem here. I have a 2gb droplet and 8gb of swap memory…
It takes more time to fill it all but it happens the same way…