Memory constantly increasing until crash

May 25, 2016 623 views
WordPress Apache

I'm running a Wordpress installation on Ubuntu. Its been working fine for a month but today it randomly crashed. It came back on restart but then kept crashing. I upgraded from a 512mb droplet to 2gb, then 4gb because I've recently added a lot of pages so thought I might just need more memory. This only stalled the crashes.

Now I've been using free -m to check memory usage, and I've noticed that the used memory is just slowly but steadily increasing until it crashes.

MySQL logs

160525  2:09:16 InnoDB: Completed initialization of buffer pool
160525  2:09:17 InnoDB: highest supported file format is Barracuda.
160525  2:09:17  InnoDB: Waiting for the background threads to start
160525  2:09:18 InnoDB: 5.5.49 started; log sequence number 39611834
160525  2:09:18 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
160525  2:09:18 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
160525  2:09:18 [Note] Server socket created on IP: '127.0.0.1'.
160525  2:09:18 [Note] Event Scheduler: Loaded 0 events
160525  2:09:18 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.5.49-0ubuntu0.14.04.1'  socket: '/var/run/mysqld/mysqld.sock'  port:                                 3306  (Ubuntu)

Apache2 logs

[Wed May 25 02:08:38.992822 2016] [core:notice] [pid 1369] AH00052: child pid 13                                76 exit signal Segmentation fault (11)
[Wed May 25 02:08:39.058648 2016] [core:notice] [pid 1369] AH00052: child pid 13                                75 exit signal Segmentation fault (11)
[Wed May 25 02:08:39.058760 2016] [core:notice] [pid 1369] AH00052: child pid 13                                77 exit signal Segmentation fault (11)
[Wed May 25 02:08:39.058828 2016] [core:notice] [pid 1369] AH00052: child pid 16                                76 exit signal Segmentation fault (11)
[Wed May 25 02:08:39.058871 2016] [core:notice] [pid 1369] AH00052: child pid 16                                82 exit signal Segmentation fault (11)
[Wed May 25 02:08:39.058909 2016] [core:notice] [pid 1369] AH00052: child pid 16                                83 exit signal Segmentation fault (11)
[Wed May 25 02:08:39.321831 2016] [core:notice] [pid 1369] AH00052: child pid 13                                82 exit signal Segmentation fault (11)
[Wed May 25 02:08:39.322120 2016] [mpm_prefork:notice] [pid 1369] AH00169: caugh                                t SIGTERM, shutting down
[Wed May 25 02:09:17.107613 2016] [mpm_prefork:notice] [pid 1040] AH00163: Apach                                e/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.16 configured -- resuming normal operations
[Wed May 25 02:09:17.109225 2016] [core:notice] [pid 1040] AH00094: Command line                                : '/usr/sbin/apache2'

I really need to get this site stable soon, so any help would be greatly appreciated. I'm quite a novice at managing servers like this.

Thanks

2 comments
  • I've done some more experimenting. It seems to relate to having mod_rewrite enabled. As far as I can tell I need to have this enabled to get custom permalinks to work, but once its enabled I seem to leak memory.

    I have moved to another droplet and it ceased. But after enabling mod rewrite in apache the leak has returned, albeit much slower.

  • What exactly is crashing? Is it MySQL, Apache?

2 Answers

mod_rewrite is part of Apache so if you have isolated the issue there then it is an apache configuration error.

mod_rewrite can do a lot of things, so depending on the configuration you setup for it is possible that there maybe a config that is causing a memory leak so you may want to check online for additional resources just to double check that the permalinks rewrite you added is correct.

You can also look to decrease the maximum number of requests that any of one of your Apache child processes processes:

MaxRequestsPerChild 128

This way after 128 requests the child process will be killed and respawned. Hopefully that can contain the memory leak a bit until you have more time to diagnose it more thoroughly.

Have another answer? Share your knowledge.