apache2 init script report start success too early

Bug #1018171 reported by Nicola on 2012-06-26
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apache2 (Ubuntu)

Bug Description

apache2 init script after executing apache2ctl start should check if apache2 is really running before reporting success,

this is problematic for example if you use apache2 init script as lsb resource in a pacemaker cluster:

1) apache2 init script report success on start
2) pacemaker monitor the resource and find that apache2 is not yet running and the cluster service fail
3) pacemaker try to restart apache, after some time the original started apache come up

adding a sleep of 5 seconds after apache2ctl start solve the problem and pacemaker does not fail. If you take a look to the apache RA script you will see that it monitor apache after starting it to make sure the web server is really started before returning success

I know ubuntu devs probably don't care about this since they want migrate init script to upstart, this bug report is to save time for people who want to use apache2 init script as lsb resource in a pacemaker cluster,

please note that apache2 init script is one of the few ubuntu init scripts lsb compliant so it could be used as lsb resource in a pacemaker cluster without patching if ubuntu could ship this script with the suggested check.

Please note that using pacemaker (main repo) in ubuntu is not so easy as should, I need to path bind9,amavis and apache2 init script to use them as lsb resource and pure-ftpd RA script (see 1017406). All the issues are fixable in few minutes maybe these small patches should be shipped in the default packages,

the bugs reported affect at least oneiric and precise


Robie Basak (racb) on 2012-06-28
Changed in apache2 (Ubuntu):
importance: Undecided → Medium
Steven Kurylo (skurylo) wrote :

This also causes the puppet init script to fail, at least for me, on precise:

The script restarts apache twice, and the second time the restart fails because apache hasn't created it's pid file yet. So the init script thinks apache isn't running.

On my system, the init script finishes at 11:21:04.823562372 while the pid file doesn't appear until 11:21:05.180181675. So there is race condition for a few hundred milliseconds.

Maybe the init script should wait until the pid file is created?

Steven Kurylo (skurylo) wrote :

There is a debian bug with a possible patch:

That patch works for me.

Changed in apache2 (Ubuntu):
status: New → Confirmed
Andreas Hasenack (ahasenack) wrote :

This was fixed in debian in apache 2.4.4-3, and Ubuntu has had 2.4.7 since trusty, so I'm going to mark this as fix released.

Changed in apache2 (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.