This is the logrotate snippet:
    prerotate
        if [ -d /etc/logrotate.d/httpd-prerotate ]; then
            run-parts /etc/logrotate.d/httpd-prerotate
        fi
    endscript
    postrotate
        if pgrep -f ^/usr/sbin/apache2 > /dev/null; then
            invoke-rc.d apache2 reload 2>&1 | logger -t apache2.logrotate
        fi
    endscript

Assuming there is no /etc/logrotate.d/httpd-prerotate, it calls the
initscript with "reload", which in the end runs:

  $APACHE2CTL graceful > /dev/null 2>&1

That $APACHE2CTL expands to something more complicated, setting env
vars, sourcing /etc/apache2/envvars, but is apache2ctl in the end.

Its manpage states:

graceful
 Gracefully restarts the Apache daemon by sending it a SIGUSR1.  If
 the daemon is not running, it is started.  This differs from a normal restart
 in  that  currently open  connections are not aborted.  A side effect is that
 old log files will not be closed immediately.  This means that if used in a log
 rotation script, a substan‐ tial delay may be necessary to ensure that the old
 log files are closed before processing them.  This  command  automatically
 checks  the  configuration  files  via apache2ctl  configtest  before
 initiating  the restart to to catch the most obvious errors.  However, it is
 still possible for the daemon to die because of problems with the
 configuration.

Which means:
a) it will wait for open connections to close "naturally"
b) old log files will not be closed immediately (presumably because a 
thread/process might still be writing to them and correspond to an open 
connection)

It is not clear how long that can take. I wonder what happens if a
connection is left open. Wouldn't that cause what we are seeing? And you
have an nginx frontend, how are such connections terminated between
apache2 and nginx, is there some sort of timeout that could be tweaked?

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2054301

Title:
  [worker/event] Some child processes aren't killed on reload
  (graceful), being stuck in state "Sending Reply", leaving old logfiles
  open, disk fills up, server stops responding after some days, DoS

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apache2/+bug/2054301/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to