Question

Mysql keeps crashing (Kill process 919 (mysqld) score 86 or sacrifice child)

Posted August 29, 2014 5.9k views

I’m using wordpress on ubuntu (standard offer, didn’t change any seetings) on minimal configuration (512 MB).
New, small blog, just 1 page and 2 posts. Maximum pageviews per day - 156 (yesterday).

Today in the morning I’ve found it doesn’t work. The reason is that mysql is down.
I’ve restarted linux. The only visitor was me. But after short time mysql was down again (there were no visitors except me, so not big load). It repeated several times.

Later I’ve created 1GB swap file. For some time it was ok. So I thought that problem was solved. But later I found that mysql was down again. So 1,5 GB is not enough?

It seems like apache eats a lot of memory at some point. But I’m not sure.

Did anyone experience the same problem? Should I change any apache or mysql settings? I thought standard offer by DigitalOcean should work properly.

Here is the part of mysql error.log during crash:

140829 23:12:04 [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.
140829 23:12:04 [Note] Plugin ‘FEDERATED’ is disabled.
140829 23:12:04 InnoDB: The InnoDB memory heap is disabled
140829 23:12:04 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140829 23:12:04 InnoDB: Compressed tables use zlib 1.2.8
140829 23:12:04 InnoDB: Using Linux native AIO
140829 23:12:04 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
140829 23:12:04 InnoDB: Completed initialization of buffer pool
140829 23:12:04 InnoDB: Fatal error: cannot allocate memory for the buffer pool
140829 23:12:04 [ERROR] Plugin 'InnoDB’ init function returned error.
140829 23:12:04 [ERROR] Plugin 'InnoDB’ registration as a STORAGE ENGINE failed.
140829 23:12:04 [ERROR] Unknown/unsupported storage engine: InnoDB
140829 23:12:04 [ERROR] Aborting

140829 23:12:04 [Note] /usr/sbin/mysqld: Shutdown complete

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.

×
3 answers

The reason was an XML-RPC attack. Here you can find an article about how to protect you WordPress site: https://www.digitalocean.com/community/tutorials/how-to-protect-wordpress-from-xml-rpc-attacks-on-ubuntu-14-04

P.S. Sorry for keeping silence. I just did’t use my DigitalOcean account for a long time:)

by Jon Schwenn
WordPress is a popular and powerful CMS (content management system) platform. Its popularity can bring unwanted attention in the form of malicious traffic specially targeted at a WordPress site. There are many instances where a server that has not been protected or optimized could experience issues or errors after receiving a small amount of malicious traffic. This guide will show you how to protect WordPress from XML-RPC attacks on an Ubuntu 14.04 system.

I always build 512MB SWAP file and is enough to run Apache + MariaDB + WordPress. I run three WordPress blogs into same droplet (512 MB RAM).

I don’t know what DO guys installed into the default WordPress image, but i suggest you to install byourself Apache + MariaDB + WordPress. You can find several tutorial and comentation into the DO community.

For this unexpected crashes i use one bash script that runs with cron every 10 min and check that some services are up (if they are down it restar them). Perhaps it helps you in the future, you can find it here

Hello, all

The key error here is:

InnoDB: Fatal error: cannot allocate memory for the buffer pool

This crash is due to your system running out of memory. I’d suggest that you add a swap file to give yourself a bit more of a buffer. Check out this tutorial:

How To Add Swap on Ubuntu 14.04

What you can also do is to use the MySQLTuner script.

The MySQLTuner is a script written in Perl and allows you to quickly test your MySQL configuration and it gives you suggestions for adjustments to increase performance and stability.

According to the official GitHub page, it supports 300 indicators for MySQL/MariaDB/Percona Server in this last version.

To run the script you could do the following:

  • SSH to your Droplet
  • Download the script:
wget http://mysqltuner.pl/ -O mysqltuner.pl
  • Then execute it:
perl mysqltuner.pl

The script would run multiple checks against your MySQL instance, all checks done by MySQLTuner are documented here.

Also as stated in the official documentation, it is still extremely important for you to fully understand each change you make to a MySQL database server. If you don’t understand portions of the script’s output, or if you don’t understand the recommendations, you should consult a knowledgeable DBA or system administrator that you trust.

As a good practice make sure to always test your changes on staging environments before implementing them on your production database.

On the same note, if you want to have a worry-free MySQL hosting and focus on your application, I would recommend trying out the DigitalOcean Managed Databases:

https://www.digitalocean.com/products/managed-databases-mysql/

This was mini tutorial was posted from @bobbyiliev in this question in our community: https://www.digitalocean.com/community/questions/how-to-tweak-mysql-mariadb-configuration-for-increased-performance-and-stability

Hope that this helps!
Regards,
Alex

by Justin Ellingwood
Swap space can be used as an "overflow" area for your system when you run out of RAM. The operating system can store data that would normally be kept in RAM on the hard drive in a specially formatted file. In this guide, we'll demonstrate how to create and use one of these files in Ubuntu 14.04.
Submit an Answer