I've got two identically configured servers with Apache2/mod_php. I added logrotate a few days ago (see the rotate script below), which worked perfectly the first 2 days. After that (and since then), Apache hangs while reloading. The master process tries to restart, leaving the child processes listening but not answering requests. Each morning I have to restart (reload doesn't work). System environment: www2 ~ # /usr/sbin/apache2 -v Server version: Apache/2.0.54 Server built: Sep 27 2005 15:36:42 www2 ~ # /usr/sbin/apache2 -l Compiled in modules: core.c prefork.c http_core.c mod_so.c www2 / # uname -a Linux www2 2.6.12-gentoo-r10 #1 SMP Tue Sep 27 14:40:30 CEST 2005 i686 AMD Athlon(tm) XP 3000+ AuthenticAMD GNU/Linux /srv/www/vhosts/logs/web2-access_log { compress delaycompress daily create 664 apache apache missingok postrotate /etc/init.d/apache2 reload endscript } Reproducible: Always Steps to Reproduce: 1. 2. 3.
What does /var/log/apache2/error_log say?
[Wed Nov 09 04:10:02 2005] [notice] Graceful restart requested, doing restart [Wed Nov 09 04:10:02 2005] [notice] Digest: generating secret for digest authentication ... [Wed Nov 09 04:10:03 2005] [crit] (4)Interrupted system call: Digest: error generating secret: Interrupted system call Configuration Failed [Wed Nov 09 11:50:24 2005] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec2) [Wed Nov 09 11:50:24 2005] [notice] Digest: generating secret for digest authentication ... [Wed Nov 09 11:50:24 2005] [notice] Digest: done [Wed Nov 09 11:50:24 2005] [warn] pid file /var/run/apache2.pid overwritten -- Unclean shutdown of previous Apache run? [Wed Nov 09 11:50:24 2005] [notice] Apache configured -- resuming normal operations
Additional note: Log entries around 11:50:24 are from the manual apache restart.
We install out own logrotate script, which does: /etc/init.d/apache2 reload > /dev/null 2>&1 || true Does the above work for you? If not, then commenting out LoadModule auth_digest_module modules/mod_auth_digest.so line in /etc/apache2/httpd.conf might solve this. That said, apache init script is broken. E.g., it fails when restarting apache. Could be easily fixed with something like: stop() { checkconfig || return 1 ebegin "Stopping apache2" ${APACHE2} ${APACHE2_OPTS} -k stop sleep 10 eend $? } which gives apache a chance to stop cleanly before starting it again, or doing some more sophisticated voodoo (like in /usr/portage/net-proxy/squid/files/squid.initd). The installed init script essentially always fails to restart apache, except for cases when apache is idle.
Okay, the first solution using /etc/init.d/apache2 reload > /dev/null 2>&1 || true certainly didn't help. I disabled the mod_auth_digest modules and I will see if it works. I do think that the 10 second sleep on a restart is a good idea and shood be implemented, or even more logic (e.g. check if apache is still running after 10 seconds, if yes, kill apache, check again, then start it). However, I'm using reload in my logrotate scripts so that shouldn't be the cause...
I had the same problems here. I disabled the digest module, this was the solution.
You can simply just do a kill -USR1 on apache, not fully restart it. It will allow apache to finish serving all current requests, rehash its config, flush and reopen all log files, all without visible interruption. You want something along the line of: kill -USR1 `cat /var/run/apache2.pid`
Closing this, if you have entropy issues w/ auth_digest_module, then recompile apr w/ USE="urandom". Not a logrotate script bug.