APC regularly restarts after 10-20 minutes

Events happening in the community are now at Drupal community events on www.drupal.org.
sgdev's picture

I have a site running Pressflow (Drupal 6), Varnish, Memcached, and APC with the Cache Router module. I'm unsure why but APC is restarting every 10-20 minutes. If I review the stats page (see the attached image) the uptime will increase to somewhere between 10 and 20 minutes. As I click the "refresh data" button I'll see a second cache set shown with an uptime of 0 or 1 minute, and each click of refresh data will toggle between uptime of 15 minutes and uptime of 1 minute. Eventually the 15 minute uptime disappears and I only see the 1 minute uptime... then the process starts all over again.

The server is running Apache 2.2.19 with worker/fcgi 2.3.6, PHP 5.3.6 and APC 3.1.9. There are no memory or disk space issues -- the server regularly runs with 3-4 GB of free RAM and there is plenty of available drive space. The site is using APC to cache the following: cache_block, cache_filter, cache_form, cache_page, and cache_views_data.

This particular server also runs WHM/cPanel, and I had read that log rotation will cause Apache to restart, which therefore causes APC to restart. However in reviewing the logs I'm not seeing a connection between the times when Apache performs a graceful restart and APC restarts.

I've adjusted the APC memory, increased ttl, gc_ttl, and user_ttl times, and tried removing some of the items being cached... the issue still persists. I could be wrong but seems as though the problem is connected to a hardware configuration issue, but I'm not sure what.

Any advice or suggestions would be appreciated. Thanks!

AttachmentSize
apc_review.jpg416.35 KB

Comments

I'm having the exact same

kourosh.a's picture

I'm having the exact same issue... any updates?!

If you are using PHP via

Steven Merrill's picture

If you are using PHP via fcgi, then an Apache restart will have no effect on APC. Is it possible that the php daemon (php-fpm?) is getting restarted?

Hi, Thanks for your reply.

kourosh.a's picture

Hi, Thanks for your reply. Yes it's running via fcgi... I'll have to check about php daemon... but pretty sure that's not the case!

Ahh - nevermind - you're

Steven Merrill's picture

Ahh - nevermind - you're using mod_fcgid, and not mod_fastcgi. I think that mod_fcgid takes care of starting a pool of PHP processes, so that might indeed be the cause.

What's the indicator that

Jamie Holly's picture

What's the indicator that it's APC crashing? My suggestion is to check the error logs. APC isn't service/process of it's own, so it won't crash alone, but rather PHP will.

Also, if you're running Munin to monitor the server (and you really should be), then install this plugin for Munin to monitor APC's status:

https://github.com/vivid-planet/munin-php-apc

That way you can go back to the time of the restart and see what APC was looking like, particularly fragmentation. Some older versions of APC would through a segfault with heavy fragmentation.


HollyIT - Grab the Netbeans Drupal Development Tool at GitHub.

Ensure you're not running out of memory

adammalone's picture

Another reason I've seen processes stop/restart is due to the OOM killer on a server. If the server is low on memory then the kernel will kill processes with a certain degree of impunity to free up that memory.

If you look in /var/log/messages (or sometimes kern.log/syslog) for telltale signs that a process has been killed you may find something PHP related in there. Here's an example from one of my boxes:

Aug 21 03:19:54 hostname kernel: Out of memory: Kill process 26413 (mysqld) score 210 or sacrifice child
Aug 21 03:19:54 hostname kernel: Killed process 26413, UID 27, (mysqld) total-vm:1142700kB, anon-rss:214252kB, file-rss:224kB