Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 485070 - sys-apps/systemd-207 fails to stop php-fpm@5.5
Summary: sys-apps/systemd-207 fails to stop php-fpm@5.5
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Gentoo systemd Team
URL:
Whiteboard: for 207-r2
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-16 07:17 UTC by timemars
Modified: 2013-10-02 19:47 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge info of systemd (file_485070.txt,5.02 KB, text/plain)
2013-09-16 07:17 UTC, timemars
Details
emerge info of php (file_485070.txt,5.39 KB, text/plain)
2013-09-16 07:19 UTC, timemars
Details
shutdown-log (shutdown-log.txt,215.17 KB, text/plain)
2013-09-22 01:38 UTC, timemars
Details

Note You need to log in before you can comment on or make changes to this bug.
Description timemars 2013-09-16 07:17:54 UTC
Created attachment 358770 [details]
emerge info of systemd

With systemd-206-r5, php-fpm@5.5 can be stop normally:

# systemctl status php-fpm@5.5
php-fpm@5.5.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib64/systemd/system/php-fpm@.service; enabled)
   Active: active (running) since 一 2013-09-16 14:29:20 CST; 57s ago
 Main PID: 253 (php-fpm)
   Status: "Processes active: 0, idle: 5, Requests: 0, slow: 0, Traffic: 0req/sec"
   CGroup: /system.slice/system-php\x2dfpm.slice/php-fpm@5.5.service
           ├─253 php-fpm: master process (/etc/php/fpm-php5.5/php-fpm.conf)
           ├─300 php-fpm: pool www
           ├─301 php-fpm: pool www
           ├─302 php-fpm: pool www
           ├─303 php-fpm: pool www
           └─304 php-fpm: pool www

9月 16 14:29:20 timemars systemd[1]: Starting The PHP FastCGI Process Manager...
9月 16 14:29:20 timemars systemd[1]: Started The PHP FastCGI Process Manager.

and after I execute the command "systemctl stop php-fpm@5.5", php-fpm@5.5 stops:

# systemctl status php-fpm@5.5
php-fpm@5.5.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib64/systemd/system/php-fpm@.service; enabled)
   Active: inactive (dead) since 一 2013-09-16 14:30:23 CST; 6s ago
  Process: 253 ExecStart=/usr/libexec/php-fpm-launcher php%I -y /etc/php/fpm-php%I/php-fpm.conf --nodaemonize (code=exited, status=0/SUCCESS)
 Main PID: 253 (code=exited, status=0/SUCCESS)
   Status: "Processes active: 0, idle: 5, Requests: 0, slow: 0, Traffic: 0req/sec"

9月 16 14:29:20 timemars systemd[1]: Starting The PHP FastCGI Process Manager...
9月 16 14:29:20 timemars systemd[1]: Started The PHP FastCGI Process Manager.
9月 16 14:30:23 timemars systemd[1]: Stopping The PHP FastCGI Process Manager...
9月 16 14:30:23 timemars systemd[1]: Stopped The PHP FastCGI Process Manager.

However, I upgraded systemd to 207 some days, and found that something had changed:

At first:
$ systemctl status php-fpm@5.5
php-fpm@5.5.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib64/systemd/system/php-fpm@.service; enabled)
   Active: active (running) since 一 2013-09-16 14:51:11 CST; 36s ago
 Main PID: 259 (php-fpm)
   Status: "Processes active: 0, idle: 5, Requests: 0, slow: 0, Traffic: 0req/sec"
   CGroup: /system.slice/system-php\x2dfpm.slice/php-fpm@5.5.service
           ├─259 php-fpm: master process (/etc/php/fpm-php5.5/php-fpm.conf)
           ├─313 php-fpm: pool www
           ├─314 php-fpm: pool www
           ├─315 php-fpm: pool www
           ├─316 php-fpm: pool www
           └─317 php-fpm: pool www

then I try to stop it using "systemctl stop php-fpm@5.5", and it hangs there:
$ systemctl status php-fpm@5.5
php-fpm@5.5.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib64/systemd/system/php-fpm@.service; enabled)
   Active: deactivating (stop-sigterm) since 一 2013-09-16 14:51:59 CST; 2s ago
 Main PID: 259
   Status: "Processes active: 0, idle: 5, Requests: 0, slow: 0, Traffic: 0req/sec"
   CGroup: /system.slice/system-php\x2dfpm.slice/php-fpm@5.5.service

1 min 30s later:
$ systemctl status php-fpm@5.5
php-fpm@5.5.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib64/systemd/system/php-fpm@.service; enabled)
   Active: deactivating (stop-sigkill) (Result: timeout) since 一 2013-09-16 14:51:59 CST; 1min 30s ago
 Main PID: 259
   Status: "Processes active: 0, idle: 5, Requests: 0, slow: 0, Traffic: 0req/sec"
   CGroup: /system.slice/system-php\x2dfpm.slice/php-fpm@5.5.service

and finally 3 mins later:
$ systemctl status php-fpm@5.5
php-fpm@5.5.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib64/systemd/system/php-fpm@.service; enabled)
   Active: failed (Result: timeout) since 一 2013-09-16 14:54:59 CST; 1s ago
 Main PID: 259
   Status: "Processes active: 0, idle: 5, Requests: 0, slow: 0, Traffic: 0req/sec"

Usually I seldom stop/restart php-fpm, so it is ok. but i stuck 3 min at shutdown/reboot, that's annoying.
Comment 1 timemars 2013-09-16 07:19:21 UTC
Created attachment 358776 [details]
emerge info of php
Comment 2 Pacho Ramos gentoo-dev 2013-09-21 14:13:53 UTC
I would report to upstream (as we are using the official unit files from php upstream)
Comment 3 timemars 2013-09-22 01:38:21 UTC
Created attachment 359212 [details]
shutdown-log

Since normal reboot or poweroff work, but take a suspiciously long time, I follow the instruction decribed at http://freedesktop.org/wiki/Software/systemd/Debugging/#index2h1, and get the shutdown-log.
Comment 4 Cănărău Constantin 2013-09-22 07:05:37 UTC
It seem that it's a systemd bug regarding Type=notify services. Here is the bug upstream: http://lists.freedesktop.org/archives/systemd-devel/2013-September/013334.html
Apply that patch solved the issue for me.
That kind of bug can drive people nuts :) - http://forums.gentoo.org/viewtopic-t-970180.html
Comment 5 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-09-22 07:34:30 UTC
We will backport the patch once one gets into systemd git.
Comment 6 timemars 2013-09-22 08:27:45 UTC
(In reply to Cănărău Constantin from comment #4)
> It seem that it's a systemd bug regarding Type=notify services. Here is the
> bug upstream:
> http://lists.freedesktop.org/archives/systemd-devel/2013-September/013334.
> html
> Apply that patch solved the issue for me.
> That kind of bug can drive people nuts :) -
> http://forums.gentoo.org/viewtopic-t-970180.html

this patch works, thanks. But there's still a problem. The patch is said to fix timeout when stopping Type=notify service, yet I notice that rsyslog.service is also a Type=notify service, and it doesn't stuck the reboot/poweroff process. It seems that only some Type=notify services cause timeout when being stopped.
Comment 7 Cănărău Constantin 2013-09-22 08:57:08 UTC
(In reply to timemars from comment #6)
> this patch works, thanks. But there's still a problem. The patch is said to
> fix timeout when stopping Type=notify service, yet I notice that
> rsyslog.service is also a Type=notify service, and it doesn't stuck the
> reboot/poweroff process. It seems that only some Type=notify services cause
> timeout when being stopped.

Yes, you are right. I didnt' notice that. But, in the end, I'm happy - everything it's working like a charm again.
Comment 8 Pacho Ramos gentoo-dev 2013-09-22 09:23:27 UTC
Thanks a lot for finding the solution :)
Comment 9 Steffen Weber 2013-09-23 08:04:07 UTC
Temporary workaround that does not require patching systemd: Edit /usr/lib/systemd/system/php-fpm@.service and add "TimeoutStopSec=2" to its "[Service]" section. According to http://www.freedesktop.org/software/systemd/man/systemd.service.html the default is 90 seconds.
Comment 10 Pacho Ramos gentoo-dev 2013-10-02 19:47:13 UTC
208 is in the tree now