Skip to content

Commit 43bc53a

Browse files
Wilhansenadoy
authored andcommitted
Fix GH-14037: Make /ping of php-fpm work with pm.status_listen pool
The ping feature of php-fpm monitoring was previously not working in pm.status_listen pool due to the configuration variables ping.path and ping.response not being copied over to the worker when forked. This results in the ping code path being disabled because the worker detects that ping.path is not configured. Closes GH-13980 Co-authored-by: Pierrick Charron <[email protected]>
1 parent c595ab9 commit 43bc53a

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ PHP NEWS
2222
- DOM:
2323
. Fixed bug GH-14343 (Memory leak in xml and dom). (nielsdos)
2424

25+
- FPM:
26+
. Fixed bug GH-14037 (PHP-FPM ping.path and ping.response config vars are
27+
ignored in status pool). (Wilhansen Li, Pierrick Charron)
28+
2529
- GD:
2630
. Fix parameter numbers for imagecolorset(). (Giovanni Giacobbi)
2731

sapi/fpm/fpm/fpm_conf.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,8 @@ static int fpm_worker_pool_shared_status_alloc(struct fpm_worker_pool_s *shared_
752752
FPM_WPC_STR_CP(config, shared_config, user);
753753
FPM_WPC_STR_CP(config, shared_config, group);
754754
FPM_WPC_STR_CP(config, shared_config, pm_status_path);
755+
FPM_WPC_STR_CP(config, shared_config, ping_path);
756+
FPM_WPC_STR_CP(config, shared_config, ping_response);
755757

756758
config->pm = PM_STYLE_ONDEMAND;
757759
config->pm_max_children = 2;

sapi/fpm/tests/status-ping.phpt

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
--TEST--
2+
FPM: Ping on the status invisible pool
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+
[unconfined]
14+
listen = {{ADDR}}
15+
pm = static
16+
pm.max_children = 1
17+
pm.status_listen = {{ADDR[status]}}
18+
pm.status_path = /status
19+
ping.path = /ping
20+
ping.response = pong
21+
EOT;
22+
23+
$tester = new FPM\Tester($cfg);
24+
$tester->start();
25+
$tester->expectLogStartNotices();
26+
$tester->ping('{{ADDR[status]}}');
27+
usleep(100000);
28+
$tester->terminate();
29+
$tester->expectLogTerminatingNotices();
30+
$tester->close();
31+
32+
?>
33+
Done
34+
--EXPECT--
35+
Done
36+
--CLEAN--
37+
<?php
38+
require_once "tester.inc";
39+
FPM\Tester::clean();
40+
?>

0 commit comments

Comments
 (0)