Question

Server leaks memory and crashes on Ubuntu 16.04 using WordPress

Hello,

I have a WordPress website that have been running 3 months on DO without any problems. Today it crashed?! I couldn’t connect through SSH (ssh_exchange_identification: read: Connection reset by peer. It didn’t accept my connection).

I restarted the server and now it’s giving me memory leak and mysql can’t start. This is driving my crazy. Any suggestion? Support tickets takes way to long to get any useful feedback from.

Thank you!


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

@marcustisater

If you’re using the one-click WordPress app that allows a 512MB Droplet to be used, that would most likely be the issue since MySQL requires quite a bit of RAM.

These two errors are the ones I look for within the error logs:

2017-07-05T18:31:31.155277Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12
2017-07-05T18:31:31.155306Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool

Anytime you’re seeing those two errors, you either need more RAM or you need to tune MySQL. In a low-RAM environment, it’s not always ease to run a full stack unless you’re able to tweak & tune the configuration for each individual piece of software (Apache, PHP, MySQL, etc).

The newer WordPress one-click app that’s now available requires at least a 1GB Droplet (512MB is no longer an option) which helps to prevent this, though in some cases, 1GB isn’t enough either.

Caching can help to reduce some of the usage (WP Super Cache, W3 Total Cache) by reducing some of the redundant database calls for each page when it hasn’t changed though, so that’d be one thing I’d recommend setting up. WP Super Cache is probably the easiest to setup overall.

https://wordpress.org/plugins/wp-super-cache/

https://wordpress.org/plugins/w3-total-cache/

The thing to remember with caching plugins is that you only need one. In this specific case, more is definitely not better :-).

As with any big change – before installing a plugin you’ve never used, I’d recommend taking a full backup of your site using a snapshot, that way you can fall back and redeploy to the state the Droplet was in before you installed. Caching plugins generally don’t cause issues, though it’s always better to be safe :-).

Hi @marcustisater

Which OS are you using? Which version of PHP+MySQL? Have you kept all services up-to-date? How big is your droplet? And are you running big plugins in WordPress?

Where is it saying something about “memory leak” ? Can you post the last 40 lines of your MySQL error log:

tail -40 /var/log/mysql/error.log