apache2 fails to wait on stop/restart

Bug #1552822 reported by David Ames on 2016-03-03
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apache2 (Ubuntu)
Undecided
Unassigned

Bug Description

Apache2 is failing to wait for all its threads to terminate when stopping. This leaves TCP ports still in use when apache2 tires to restart. This has been seen on Trusty and Xenial

This becomes a problems on restarts and stop/starts.

I have seen this running a simple loop with service apache2 restart. However this is inconsistent.

It happens more predictably when wsgi is involved even if stop and then start are used instead of restart:

 * Stopping web server apache2
 *
 * Starting web server apache2
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Action 'start' failed.
The Apache error log may have more information.

ChristianEhrhardt (paelzer) wrote :

Hi David,
I tried reproducing this while triaging to confirm and set bug status.

In a trivial loop like:
  for i in {1..100}; do echo $i; service apache2 restart; done;
It almost always blocks it by
  Mar 31 11:09:34 xenial-tests systemd[1]: apache2.service: Start request repeated too quickly.
  Mar 31 11:09:34 xenial-tests systemd[1]: Failed to start LSB: Apache2 web server.

I also installed wsgi and some other mods to slow down start/stop, but that didn't help either.
(apt-get install libapache2-mod-wsgi libapache2-mod-nss libapache2-mod-scgi libapache2-mod-webauth libapache2-modsecurity)
Installing these slows it down, so that systemd no more complains about it restarting too quickly, but it doesn't trigger the issue.

Did you something more to better trigger the issue in your tests?

ChristianEhrhardt (paelzer) wrote :

I wonder if this bug might be related.
Similar errors also using wsgi to make it more reproducable, ...

https://bugs.launchpad.net/ubuntu/+source/apache2/+bug/1428796

Did you set up something similar for your wsgi and if so would it qualify as a dup to the other bug or should we keep it separate?

David Ames (thedac) wrote :

Christian,

Sorry for taking so long to get back to you.

We see this in the OpenStack charming team with openstack-dashboard (horizon) and keystone (when run on apache2 >= liberty). We have had to implement hacky work-arounds because apache2 is not waiting until it releases the port(s) before exiting.

You can deploy either of these and then test my loop from above.
  juju deploy openstack-dashboard

The 1428796 is similar in that apache2 is not waiting till it releases ports, but we see this on trusty and xenial so it is not systemd specific.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers