You are not logged in.

#1 2013-09-21 15:11:40

digirium
Member
Registered: 2012-11-15
Posts: 51

systemctl stop php-fpm takes 3 minutes

As subject, stopping php-fpm service started to take three minutes after systemd was updated recently.

Enabled debug in configuration file and php-fpm was stopping immediately. However the systemctl stop command runs for a further three minutes before ending. No error exit code but status after stop says Active: failed (Result: timeout).

# systemctl status php-fpm
php-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled)
   Active: failed (Result: timeout) since Sat 2013-09-21 16:06:12 BST; 2min 57s ago
 Main PID: 421
   Status: "Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req/sec"

This also of course slows down shutdown.

Any thoughts or ideas?

smile

Offline

#2 2013-09-21 19:28:26

pilgrim85
Member
Registered: 2013-09-21
Posts: 1

Re: systemctl stop php-fpm takes 3 minutes

I had the same problem, I changed /usr/lib/systemd/system/php-fpm.service to read as:

[Unit]
Description=The PHP FastCGI Process Manager
After=syslog.target network.target

[Service]
Type=notify
PIDFile=/run/php-fpm/php-fpm.pid
PrivateTmp=true
ExecStart=/usr/bin/php-fpm --daemonize --pid /run/php-fpm/php-fpm.pid
ExecReload=/bin/kill -USR2 $MAINPID

[Install]
WantedBy=multi-user.target

Note the change from --nodaemonize to --daemonize. This caused 'systemctl start php-fpm' to take slightly more time than when using --nodaemonize but resulted in 'systemctl stop php-fpm' being near instantaneous. I figured the trade off for the delay at startup was acceptable to prevent a 3 minute delay during shutdown.

Last edited by pilgrim85 (2013-09-21 19:28:54)

Offline

#3 2013-09-21 20:14:26

digirium
Member
Registered: 2012-11-15
Posts: 51

Re: systemctl stop php-fpm takes 3 minutes

Thanks pilgrim85 that workaround works well for me too.

smile

Offline

#4 2013-09-21 21:41:40

jjacky
Member
Registered: 2011-11-09
Posts: 347
Website

Re: systemctl stop php-fpm takes 3 minutes

The "fake" timeout is a bug in systemd relative to Type=notify service, this patch should solved it.

Offline

#5 2013-09-24 15:37:06

bsujja
Member
From: Thailand
Registered: 2013-01-27
Posts: 19

Re: systemctl stop php-fpm takes 3 minutes

jjacky wrote:

The "fake" timeout is a bug in systemd relative to Type=notify service, this patch should solved it.

Sorry but I don't know how to apply the patch. I can't find /src/core/service.c anywhere.

Offline

#6 2013-09-25 12:22:55

jjacky
Member
Registered: 2011-11-09
Posts: 347
Website

Re: systemctl stop php-fpm takes 3 minutes

It's a patch for systemd, see https://bugs.archlinux.org/task/37007

Offline

Board footer

Powered by FluxBB