[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#868861: marked as done (apache2: Package upgrade does not play well with multiple instances and restarting them)



Your message dated Thu, 23 Sep 2021 12:48:27 +0000
with message-id <E1mTO9L-000H5Y-UR@fasolo.debian.org>
and subject line Bug#868861: fixed in apache2 2.4.49-2
has caused the Debian Bug report #868861,
regarding apache2: Package upgrade does not play well with multiple instances and restarting them
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
868861: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=868861
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: apache2
Version: 2.4.10-10+deb8u10
Severity: normal

Dear Maintainer,

I use multiple apache2 instances facility on several of my servers using the
debian example script to set them up - i.e. they're set up using
/usr/share/doc/apache2/examples/setup-instance

When doing security updates via apt-get upgrade then the postinst
script doesn't restart anything other than the default instance.
This obviously isn't much of a surprise (although it would be nice
if there was a way of registering them for restart on upgrade).
However it strikes me that this behaviour might be something worth
noting in the README.multiple-instances file though as it means the
admin will need to notice when apache2 is upgraded and manually restart
the other instances.

That's not the main reason for this report though - the main reason is
that after the postinst script has restarted the main instance if you
then try manually restart the other instances via any mechanism which
uses /etc/init.d/apache2 and if the /usr/sbin/apache2 binary has been
updated by the upgrade then you get:

[FAIL] Restarting web server: apache2 failed!
[....] There are processes named 'apache2' running which do not match your pid file which are left untouched in the name of safety,|Please review the situation by hand. |
The reason for this appears to be down to the behaviour of pidof which
the /etc/init.d/apache2 script uses to perform this safety check.

It appears that debian's pidof will first try find process matches by device/inode
pair (i.e. where the process executable's device/inode pair matches the device/inode
pair of the binary, if it's located on a local filesystem). Only if it finds no
matches that way does it then try to find matches based on full path name instead.

Straight after upgrading apache the binary /usr/sbin/apache2
has a different device/inode pair to that of all the running /usr/sbin/apache
processes (as they were run from the prior binary version which is now deleted).

So when the postinst script for apache triggers a restart of the main instance
then pidof in the safety check will list pids of the all instances (because it finds none
matching the exact device/incode pair, so falls back on finding ones matching
the path). Thus that restart will pass the check and proceed ok.

After that restart the main apache2 instance is running from the new binary
and so its device/inode pair matches /usr/sbin/apache. Running pidof
/usr/sbin/apache2 will now thus only list the pids of the main apache instance
processes because it finds at least one matching the device/inode pair in
a running process and so it doesn't list those processes from the other instances
(because they're still running off the old now-deleted binary with a different
device/inode pair). Hence when you try use the init script for the instance to
stop/restart apache you now get the error about not matching the pidfile.
E.g. these will error while the system is in that state:

service apache2-instancename restart
/etc/init.d/apache2-instancename restart

The apache2ctl command has no such check on the contents of the pidfile I believe
and so will still work, so e.g. this will work:
/usr/local/sbin/apache2ctl-instancename stop
/usr/local/sbin/apache2ctl-instancename start

And also you can manually kill the old process using the pid in the pidfile and then
use service start or the init.d script for the instance.

Once the other instances running off the previous binary have been restarted using either
of these interventions then pidof will start listing them again.

I've no idea how you might resolve the issue though other than maybe weakening
the pidof check in the init script to just check for "apache2" instead
of the full path of "/usr/sbin/apache2" or alternatively just document
this issue in the README so at least people using multiple-instances know that upgrading the
apache2 package need to watch out for this (and perhaps just stop all
instances prior to doing the package upgrade so they don't have any
running off the prior binary).

I've had a quick look at the apache2 source in experimental and it seems to have
the same check in the apache2 init script, so this report should be valid against
the latest version.

Regards,
Matt

--- End Message ---
--- Begin Message ---
Source: apache2
Source-Version: 2.4.49-2
Done: Yadd <yadd@debian.org>

We believe that the bug you reported is fixed in the latest version of
apache2, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 868861@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Yadd <yadd@debian.org> (supplier of updated apache2 package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Thu, 23 Sep 2021 13:55:55 +0200
Source: apache2
Architecture: source
Version: 2.4.49-2
Distribution: unstable
Urgency: medium
Maintainer: Debian Apache Maintainers <debian-apache@lists.debian.org>
Changed-By: Yadd <yadd@debian.org>
Closes: 868861
Changes:
 apache2 (2.4.49-2) unstable; urgency=medium
 .
   [ Michiel Hazelhof ]
   * Fix multi instance issue (Closes: #868861)
 .
   [ Philippe Ombredanne ]
   * Fix GPL version typo in copyright file
Checksums-Sha1: 
 6e6bc014e7d51ea18bf31fe7aa91d6540bdf2ecf 3477 apache2_2.4.49-2.dsc
 8bf6a419e3b28098402b2b96cb94dd1b9731b8ab 1039620 apache2_2.4.49-2.debian.tar.xz
Checksums-Sha256: 
 e95956a0c905f1d4ed81f6d823b42159a4c485d3f42e9f397fce92697bb92c24 3477 apache2_2.4.49-2.dsc
 faf8a0783b9a2e560329d474840bbb1ec9deebd0ff77aa081817e58d3b2828dd 1039620 apache2_2.4.49-2.debian.tar.xz
Files: 
 ab12aca03c4a34af314d5077df9ebc64 3477 httpd optional apache2_2.4.49-2.dsc
 aad3ef1dda236e9990bbc07fe626954d 1039620 httpd optional apache2_2.4.49-2.debian.tar.xz

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEAN/li4tVV3nRAF7J9tdMp8mZ7ukFAmFMdFsACgkQ9tdMp8mZ
7ukGEQ//RBqZYMZr6EJAj0XNnsMzhX1HBMaJSm9/lbLsNuFB1Ad2Nk5XNbNwvJHs
4owTp3GxCecLB+ETQB5wkZb6BHSKJsSX8A9S9kEzXNht5cPqZV+JPwzt7/VtE/s3
F3bag7IOWWJD3oWnR4eXL9ucUwXYlx+4kIgBmsRqC8Ap06OwCwoeS/F17dL7tzTf
27ZI1GdUVtQEqctV+/G1g1f31DGMmx1oSudNSTRgmt2vUwNM/KBkzQ9/7O+fSNMA
mutTxt/gC74OD/QWM8GQnMzobsrGyii90G7SWN70IEcyRy9hUMgWZodR+hHwgpOd
vebzMbjE+rmjRx10nv2NNUQDFcOazHi1WKt2xDJ8Q3tPfJlPvdTFnahNsAlxSF3s
sOTTnkpjsvlC8Oc3UicerLm0rS1Bv7iwlHoDDE462Bgxw3L+If7WDGxc17Zso0Ny
c1Z7SVjo5SJaYt6b6wTmXC3onIUP6cYwxpoRdIi7z1m6tS3jc6LEr1LBTsqo3q80
kISgvgrtA1z6hCM/AlthzdiAJ5ucwkRm53aBhOQ3bnZnrqISAGAUfUXyJrPy+mVQ
5ecQ0tcTu9u6gj5wgzno3dHISZXQYe5PMlBNzsVn7FcIRvwRDlqgzVSnayoroVZi
rwbR8A9mKiBeyON4ZAnQReJ0n/15k+1N2fnR661SgNPwhAZzE9o=
=+/zh
-----END PGP SIGNATURE-----

--- End Message ---

Reply to: