1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

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 <pierrick@php.net>
This commit is contained in:
Wilhansen Li
2024-04-17 00:48:58 +08:00
committed by Jakub Zelenka
parent c595ab96ab
commit 43bc53a730
3 changed files with 46 additions and 0 deletions

4
NEWS
View File

@@ -22,6 +22,10 @@ PHP NEWS
- DOM:
. Fixed bug GH-14343 (Memory leak in xml and dom). (nielsdos)
- FPM:
. Fixed bug GH-14037 (PHP-FPM ping.path and ping.response config vars are
ignored in status pool). (Wilhansen Li, Pierrick Charron)
- GD:
. Fix parameter numbers for imagecolorset(). (Giovanni Giacobbi)

View File

@@ -752,6 +752,8 @@ static int fpm_worker_pool_shared_status_alloc(struct fpm_worker_pool_s *shared_
FPM_WPC_STR_CP(config, shared_config, user);
FPM_WPC_STR_CP(config, shared_config, group);
FPM_WPC_STR_CP(config, shared_config, pm_status_path);
FPM_WPC_STR_CP(config, shared_config, ping_path);
FPM_WPC_STR_CP(config, shared_config, ping_response);
config->pm = PM_STYLE_ONDEMAND;
config->pm_max_children = 2;

View File

@@ -0,0 +1,40 @@
--TEST--
FPM: Ping on the status invisible pool
--SKIPIF--
<?php include "skipif.inc"; ?>
--FILE--
<?php
require_once "tester.inc";
$cfg = <<<EOT
[global]
error_log = {{FILE:LOG}}
[unconfined]
listen = {{ADDR}}
pm = static
pm.max_children = 1
pm.status_listen = {{ADDR[status]}}
pm.status_path = /status
ping.path = /ping
ping.response = pong
EOT;
$tester = new FPM\Tester($cfg);
$tester->start();
$tester->expectLogStartNotices();
$tester->ping('{{ADDR[status]}}');
usleep(100000);
$tester->terminate();
$tester->expectLogTerminatingNotices();
$tester->close();
?>
Done
--EXPECT--
Done
--CLEAN--
<?php
require_once "tester.inc";
FPM\Tester::clean();
?>