php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77023 PHP-FPM cannot shutdown processes
Submitted: 2018-10-16 11:30 UTC Modified: -
From: azurit at pobox dot sk Assigned:
Status: Open Package: FPM related
PHP Version: 7.2.11 OS: Debian 9
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2018-10-16 11:30 UTC] azurit at pobox dot sk
Description:
------------
I'm not albe to reproduce this problem but it is sometimes happening to pool of one of our customers. Pool si set like this:

pm = dynamic
pm.max_children = 30
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 1

I want from it to keep only one IDLE process at a time but FPM sometimes fails to kill IDLE processes (kill because of pm.max_spare_servers) which results into having 30 IDLE processes (or other number, depends on pm.max_children). When i start killing FPM processes by hand, FPM is starting them back BUT there are always few stucked FPM processes (probably the ones which were running for longest time) which, if are killed, FPM itself starts killing also other IDLE processes (like it was waiting for them to shutdown before start shutdowning other processes) and everything goes to normal. I was able to get a strace output from one such process:


socket(AF_UNIX, SOCK_STREAM, 0)         = 0
rt_sigreturn({mask=[]})                 = 43
accept(26, 0x7ffee4d3f860, [112])       = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGQUIT {si_signo=SIGQUIT, si_code=SI_USER, si_pid=30660, si_uid=0} ---
close(0)                                = 0
socket(AF_UNIX, SOCK_STREAM, 0)         = 0
rt_sigreturn({mask=[]})                 = 43
accept(26, 0x7ffee4d3f860, [112])       = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGQUIT {si_signo=SIGQUIT, si_code=SI_USER, si_pid=30660, si_uid=0} ---
close(0)                                = 0
socket(AF_UNIX, SOCK_STREAM, 0)         = 0
rt_sigreturn({mask=[]})                 = 43
accept(26, 0x7ffee4d3f860, [112])       = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGQUIT {si_signo=SIGQUIT, si_code=SI_USER, si_pid=30660, si_uid=0} ---
close(0)                                = 0
socket(AF_UNIX, SOCK_STREAM, 0)         = 0
rt_sigreturn({mask=[]})                 = 43
accept(26, 0x7ffee4d3f860, [112])       = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGQUIT {si_signo=SIGQUIT, si_code=SI_USER, si_pid=30660, si_uid=0} ---
close(0)                                = 0
socket(AF_UNIX, SOCK_STREAM, 0)         = 0
rt_sigreturn({mask=[]})                 = 43
accept(26, 0x7ffee4d3f860, [112])       = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGQUIT {si_signo=SIGQUIT, si_code=SI_USER, si_pid=30660, si_uid=0} ---
close(0)                                = 0
socket(AF_UNIX, SOCK_STREAM, 0)         = 0
rt_sigreturn({mask=[]})                 = 43
accept(26, 0x7ffee4d3f860, [112])       = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGQUIT {si_signo=SIGQUIT, si_code=SI_USER, si_pid=30660, si_uid=0} ---
close(0)                                = 0
socket(AF_UNIX, SOCK_STREAM, 0)         = 0
rt_sigreturn({mask=[]})                 = 43
accept(26, 0x7ffee4d3f860, [112])       = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGQUIT {si_signo=SIGQUIT, si_code=SI_USER, si_pid=30660, si_uid=0} ---
close(0)                                = 0
socket(AF_UNIX, SOCK_STREAM, 0)         = 0
rt_sigreturn({mask=[]})                 = 43
accept(26, 0x7ffee4d3f860, [112])       = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGQUIT {si_signo=SIGQUIT, si_code=SI_USER, si_pid=30660, si_uid=0} ---
close(0)                                = 0
socket(AF_UNIX, SOCK_STREAM, 0)         = 0
rt_sigreturn({mask=[]})                 = 43
accept(26, 0x7ffee4d3f860, [112])       = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGQUIT {si_signo=SIGQUIT, si_code=SI_USER, si_pid=30660, si_uid=0} ---
close(0)                                = 0
...




Look on this:


# ps aux | grep customer1 | grep fpm | wc -l
11

# ps aux | grep customer1 | grep fpm
customer1   2345  0.0  0.1 398280 20640 ?        S    12:34   0:00 php-fpm: pool customer1
customer1   3295  0.4  0.2 493180 47964 ?        S    12:34   0:12 php-fpm: pool customer1
customer1  10887  0.4  0.2 489452 43628 ?        S    12:35   0:12 php-fpm: pool customer1
customer1  12018  0.6  0.3 497272 50852 ?        S    12:35   0:18 php-fpm: pool customer1
customer1  12707  0.4  0.3 496552 51748 ?        S    12:35   0:14 php-fpm: pool customer1
customer1  13157  0.5  0.4 511312 65676 ?        S    12:35   0:15 php-fpm: pool customer1
customer1  15860  0.6  0.3 797176 53464 ?        S    12:36   0:17 php-fpm: pool customer1
customer1  15941  0.5  0.3 788804 50856 ?        S    12:36   0:16 php-fpm: pool customer1
customer1  23635  0.0  0.1 398280 20636 ?        S    13:24   0:00 php-fpm: pool customer1
customer1  23636  0.0  0.1 398280 20636 ?        S    13:24   0:00 php-fpm: pool customer1
customer1  23637  0.0  0.1 398280 20636 ?        S    13:24   0:00 php-fpm: pool customer1

// the one, which is stucked here, is PID 2345
// let's try to kill few processes except 2345

# skill -kill 10887 12018 13157 23635 23637

# ps aux | grep customer1 | grep fpm | wc -l
11

# ps aux | grep customer1 | grep fpm
customer1   2345  0.0  0.1 398280 20640 ?        S    12:34   0:00 php-fpm: pool customer1
customer1   3295  0.4  0.3 508332 63120 ?        S    12:34   0:14 php-fpm: pool customer1
customer1  12707  0.5  0.3 494504 49876 ?        S    12:35   0:15 php-fpm: pool customer1
customer1  15860  0.6  0.4 813560 68608 ?        S    12:36   0:19 php-fpm: pool customer1
customer1  15941  0.5  0.3 795164 56780 ?        R    12:36   0:17 php-fpm: pool customer1
customer1  23636  0.4  0.2 485492 37128 ?        R    13:24   0:00 php-fpm: pool customer1
customer1  26450  2.7  0.2 416048 43144 ?        S    13:26   0:00 php-fpm: pool customer1
customer1  26451  2.5  0.2 416048 43144 ?        S    13:26   0:00 php-fpm: pool customer1
customer1  26452  2.6  0.2 416048 43156 ?        S    13:26   0:00 php-fpm: pool customer1
customer1  26453  2.5  0.2 416048 43140 ?        S    13:26   0:00 php-fpm: pool customer1
customer1  26454  0.0  0.1 398660 26028 ?        S    13:26   0:00 php-fpm: pool customer1

// now let's kill 2345

# skill -kill 2345

# ps aux | grep customer1 | grep fpm | wc -l
1

# ps aux | grep customer1 | grep fpm
customer1  27650  0.1  0.1 398660 26760 ?        S    13:27   0:00 php-fpm: pool customer1



Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 15:01:26 2019 UTC