Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 412241

Summary: www-servers/apache init script on lxc/openvz/vserver host
Product: Gentoo Linux Reporter: Vadim Kuznetsov (RETIRED) <vadimk>
Component: New packagesAssignee: Apache Team - Bugzilla Reports <apache-bugs>
Status: CONFIRMED ---    
Severity: normal CC: g2-mail, mail, nikoli, proxy-maint
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Vadim Kuznetsov (RETIRED) gentoo-dev 2012-04-16 17:55:14 UTC
It seems to me that start case of apache init script should include --pidfile option like so:
start-stop-daemon --start --pidfile "${PIDFILE}" ${APACHE2} -- ${APACHE2_OPTS} -k start

s-s-d will try to find out if service is already runnig and will try to stop it before it will attempt to start it.
If you don't supply --pidfile,  s-s-d will look for service in /proc by name.

It's all fine, unless you have lxc container that is running apache as well.
s-s-d will find container apache in /proc by name, then it will try to kill it (this is already not what we want.) and fail. 
And after that s-s-d will fail to start service on the host on the ground that is already running.
If you supply --pidfile s-s-d will search /proc by pid only and will not find service running in the lxc container.
Comment 1 LW 2012-06-21 17:59:39 UTC
The pidfile issue also affects running multiple apache instances:
    www-servers/apache-2.2.22-r1

Setting
    PIDFILE=/home/pmirror/run/apache2.pid
in
    /etc/conf.d/pmirror
has no affect.

The pidfile is still created as
    /var/run/apache2.pid
even though the rest of the conf variables are used,
such as STARTUPERRORLOG="/var/log/apache2/pmirror-startuperror.log"

A possibly related issue is that the startup is delayed for 5 seconds
or so.