Skip to content

Commit cc5c51e

Browse files
committed
Fix bug #77934 (php-fpm kill -USR2 not working)
1 parent b15bfb9 commit cc5c51e

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ PHP NEWS
33
?? ??? 2019, PHP 7.2.19
44

55
- FPM:
6+
. Fixed bug #77934 (php-fpm kill -USR2 not working). (Jakub Zelenka)
67
. Fixed bug #77921 (static.php.net doesn't work anymore). (Peter Kokot)
78

89
- GD:

sapi/fpm/fpm/fpm_signals.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ static void sig_soft_quit(int signo) /* {{{ */
143143
int saved_errno = errno;
144144

145145
/* closing fastcgi listening socket will force fcgi_accept() exit immediately */
146-
close(0);
146+
close(fpm_globals.listening_socket);
147147
if (0 > socket(AF_UNIX, SOCK_STREAM, 0)) {
148148
zlog(ZLOG_WARNING, "failed to create a new socket");
149149
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
--TEST--
2+
FPM: bug77934 - php-fpm kill -USR2 not working
3+
--SKIPIF--
4+
<?php include "skipif.inc"; ?>
5+
--FILE--
6+
<?php
7+
8+
require_once "tester.inc";
9+
10+
$cfg = <<<EOT
11+
[global]
12+
error_log = {{FILE:LOG}}
13+
pid = {{FILE:PID}}
14+
process_control_timeout=20
15+
[unconfined]
16+
listen = {{ADDR}}
17+
pm = dynamic
18+
pm.max_children = 5
19+
pm.start_servers = 1
20+
pm.min_spare_servers = 1
21+
pm.max_spare_servers = 1
22+
EOT;
23+
24+
$tester = new FPM\Tester($cfg);
25+
$tester->start();
26+
$tester->expectLogStartNotices();
27+
$tester->signal('USR2');
28+
$tester->expectLogNotice('Reloading in progress ...');
29+
$tester->expectLogNotice('reloading: .*');
30+
$tester->expectLogNotice('using inherited socket fd=\d+, "127.0.0.1:\d+"');
31+
$tester->expectLogStartNotices();
32+
$tester->terminate();
33+
$tester->expectLogTerminatingNotices();
34+
$tester->close();
35+
36+
?>
37+
Done
38+
--EXPECT--
39+
Done
40+
--CLEAN--
41+
<?php
42+
require_once "tester.inc";
43+
FPM\Tester::clean();
44+
?>

0 commit comments

Comments
 (0)