Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 481346 - www-servers/apache - sometimes restart operation fails
Summary: www-servers/apache - sometimes restart operation fails
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Lars Wendler (Polynomial-C)
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2013-08-16 17:35 UTC by Andrey Niahajchyk
Modified: 2014-05-22 15:43 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Niahajchyk 2013-08-16 17:35:40 UTC
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.
Comment 1 Andrey Niahajchyk 2013-08-16 17:49:50 UTC
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 ]
Comment 2 Lars Wendler (Polynomial-C) gentoo-dev 2014-04-24 10:04:47 UTC
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.
Comment 3 Lars Wendler (Polynomial-C) gentoo-dev 2014-05-22 15:43:22 UTC
This is fixed in =www-servers/apache-2.2.27-r3 and =www-servers-apache/2.4.9-r3.