If one of apache subprocess needs some time to release resources, apache won't be restarted correctly. Reproducible: Sometimes Steps to Reproduce: 1. Use mod_wsgi with Django 2. Connect wsgi.py with http://newrelic.com/ for monitoring or add into wsgi.py any functionality that increases time for destroing apache subprocess wit mod_wsgi Actual Results: /etc/init.d/apache2 restart * Caching service dependencies ... [ ok ] * Stopping apache2 ... [ ok ] * Starting apache2 ... * start-stop-daemon: /usr/sbin/apache2 is already running [ ok ] Expected Results: /etc/init.d/apache2 restart * Caching service dependencies ... [ ok ] * Stopping apache2 ... [ ok ] * Starting apache2 ... [ ok ] The init.d script detect status of stop operation incorrectly. It uses the following code: while ( test -f "${PIDFILE}" && pgrep -P ${PID} apache2 >/dev/null ) \ && [ $i -lt ${TIMEOUT} ]; do sleep 1 && i=$(expr $i + 1) done but it should be replaced to: while ( test -f "${PIDFILE}" || pgrep -P ${PID} apache2 >/dev/null ) \ && [ $i -lt ${TIMEOUT} ]; do sleep 1 && i=$(expr $i + 1) done Problem that PIDFILE will disappear immediately but pgrep can report about apache processes longer.
Full Actual Results: /etc/init.d/apache2 restart * Caching service dependencies ... [ ok ] * Stopping apache2 ... [ ok ] * Starting apache2 ... * start-stop-daemon: /usr/sbin/apache2 is already running [ ok ] /etc/init.d/apache2 restart * apache2 not running (no pid file) * Starting apache2 ... [ ok ]
Does this problem still exist in >=www-servers/apache-2.2.25? I did some rework of apache's init script and might have already addressed this problem.
This is fixed in =www-servers/apache-2.2.27-r3 and =www-servers-apache/2.4.9-r3.