Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#43486 - [apache] 'systemctl stop' and shutdown hangs +- 60s

Attached to Project: Arch Linux
Opened by Vincent Van Houtte (zenlord) - Saturday, 17 January 2015, 10:33 GMT
Last edited by Anatol Pomozov (anatolik) - Wednesday, 27 January 2016, 04:33 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Jan de Groot (JGC)
Anatol Pomozov (anatolik)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
Whenever I stop apache using the 'systemctl stop' command, it takes a while to actually stop the service and return a new prompt. The behaviour is the same when shutting down the system while the apache daemon is running, causing long shutdown delays.

Additional info:
* package version(s)
Archlinux 64, updated (but problem has existed a few months now on my laptop, which I seldom use)
* config and/or log files etc.
Same bug in Fedora bugtracker: https://bugzilla.redhat.com/show_bug.cgi?id=906321

Steps to reproduce:
systemctl stop httpd
or
reboot / shutdown -h now

Solution / workaround:
Add 'KillMode=none' to httpd.service-file
(I'm not sure how 'clean' this is as a solution/workaround, but it does work)
This task depends upon

Closed by  Anatol Pomozov (anatolik)
Wednesday, 27 January 2016, 04:33 GMT
Reason for closing:  Fixed
Comment by Vincent Van Houtte (zenlord) - Saturday, 17 January 2015, 11:20 GMT
Sorry, seems like the suggested fix is not helping to reduce the shutdown-time. If I shutdown httpd manually before the shutdown, the shutdown process takes ~3s... something in apache is holding back the shutdown process
Comment by Vincent Van Houtte (zenlord) - Saturday, 17 January 2015, 13:07 GMT
I found other bug reports related to handling apache by systemd. There seems to be an Apache module to better work with systemd:
http://httpd.apache.org/docs/trunk/mod/mod_systemd.html
Comment by patrick (potomac) - Sunday, 25 October 2015, 18:52 GMT
this bug seems to occur randomly with apache 2.4.17-2,

It doesn't occur all the time, but when it occurs systemd takes a very long time when he wants to stop httpd service,

I am wondering if the problem would be the /usr/lib/systemd/system/httpd.service file, a wrong parameter inside this file ?
Comment by Paul Mulders (justinkb) - Tuesday, 27 October 2015, 11:30 GMT
Running into this, too. Quite annoying when debugging httpd config changes repeatedly.

Might looking at http://pkgs.fedoraproject.org/cgit/httpd.git/log/httpd.service?h=f23 be of use in any way?
Comment by patrick (potomac) - Tuesday, 27 October 2015, 20:24 GMT
when the bug occurs here are the error messages in journalctl :

systemd[1]: httpd.service: State 'stop-final-sigterm' timed out. Killing.
systemd[1]: httpd.service: Unit entered failed state.
systemd[1]: httpd.service: Failed with result 'timeout'.

$ systemctl status httpd
● httpd.service - Apache Web Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: failed (Result: timeout) since mar. 2015-10-27 20:04:15 CET; 1h 16min ago
Process: 2415 ExecStop=/usr/bin/apachectl graceful-stop (code=exited, status=0/SUCCESS)
Process: 2266 ExecStart=/usr/bin/apachectl start (code=exited, status=0/SUCCESS)
Main PID: 2269 (code=exited, status=0/SUCCESS)
Comment by Anatol Pomozov (anatolik) - Tuesday, 27 October 2015, 20:51 GMT
The Fedora systemd service file has two related config options:

KillSignal=SIGWINCH
KillMode=mixed

Could you please try it and see if any of these options fixes the problem for you?
Comment by patrick (potomac) - Wednesday, 28 October 2015, 00:51 GMT
@anatolik :Ok I will try these 2 options

I notice also this error message in journalctl :
httpd.service: PID file /run/httpd/httpd.pid not readable (yet?) after start: No such file or directory

the wiki gives this solution but it doesn't work :

https://wiki.archlinux.org/index.php/Apache_HTTP_Server#Error:_PID_file_.2Frun.2Fhttpd.2Fhttpd.pid_not_readable_.28yet.3F.29_after_start
Comment by Anatol Pomozov (anatolik) - Wednesday, 28 October 2015, 00:54 GMT
That message seems irrelevant.

BTW I just merged this change https://projects.archlinux.org/svntogit/packages.git/commit/trunk?h=packages/apache&id=7e862c952493c891ddc3497824138574438a4c76 Could you please try if it makes any difference for you?
Comment by patrick (potomac) - Wednesday, 28 October 2015, 02:21 GMT
@anatolik : your change in git doesn't solve the problem, the bug is still here ( randomly ), you should revert your changes,

systemd[1]: httpd.service: State 'stop-final-sigterm' timed out. Killing.
systemd[1]: httpd.service: Unit entered failed state.
systemd[1]: httpd.service: Failed with result 'timeout'.

but I think that adding these two lines ( from fedora ) can solve the problem :

KillSignal=SIGWINCH
KillMode=mixed

but I am not sure at 100% because it's a random bug ( it's difficult to reproduce it )

the complete new httpd systemd file :

[Unit]
Description=Apache Web Server
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/run/httpd/httpd.pid
ExecStart=/usr/bin/apachectl start
ExecStop=/usr/bin/apachectl graceful-stop
ExecReload=/usr/bin/apachectl graceful
PrivateTmp=true
LimitNOFILE=infinity
KillSignal=SIGWINCH
KillMode=mixed


[Install]
WantedBy=multi-user.target
Comment by Anatol Pomozov (anatolik) - Wednesday, 28 October 2015, 04:23 GMT
> you should revert your changes

My submitted change is not for this bug but a simplification that removes need for a background process. I am not going to revert unless it introduces new problems.
Comment by Anatol Pomozov (anatolik) - Saturday, 31 October 2015, 05:34 GMT
Could you please check which exactly line fixes the problem:

KillSignal=SIGWINCH

or

KillMode=mixed

Or both required.
Comment by patrick (potomac) - Saturday, 31 October 2015, 20:15 GMT
@anatolik : I did the tests, and I think the line who fixes the problem is :

KillMode=mixed


Comment by Anatol Pomozov (anatolik) - Saturday, 31 October 2015, 21:59 GMT
'KillMode=mixed' has been added to httpd.service file and will be available with the next apache package revision.
Comment by Anatol Pomozov (anatolik) - Wednesday, 27 January 2016, 04:33 GMT

Loading...