com php-src: Add (slow) test for fpm concurrent reloads #74083: sapi/fpm/tests/bug74083-concurrent-reload.phpt

From: Date: Sun, 20 Oct 2019 15:08:55 +0000
Subject: com php-src: Add (slow) test for fpm concurrent reloads #74083: sapi/fpm/tests/bug74083-concurrent-reload.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-108976@lists.php.net to get a copy of this message
Commit: 2f9f40915606f34b177b722d50a7ed4ce43adfc7 Author: Maksim Nikulin <mnikulin@plesk.com> Thu, 25 Jul 2019 11:41:36 +0700 Committer: Jakub Zelenka <bukka@php.net> Sun, 20 Oct 2019 16:08:55 +0100 Parents: ae5154c6c6af7ba7c592f8af006b7cadd0d66d6e Branches: PHP-7.4 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2f9f40915606f34b177b722d50a7ed4ce43adfc7 Log: Add (slow) test for fpm concurrent reloads #74083 Bugs: https://bugs.php.net/74083 Changed paths: A sapi/fpm/tests/bug74083-concurrent-reload.phpt Diff: diff --git a/sapi/fpm/tests/bug74083-concurrent-reload.phpt b/sapi/fpm/tests/bug74083-concurrent-reload.phpt new file mode 100644 index 00000000000..532c3b10bf8 --- /dev/null +++ b/sapi/fpm/tests/bug74083-concurrent-reload.phpt @@ -0,0 +1,76 @@ +--TEST-- +Concurrent reload signals should not kill PHP-FPM master process. (Bug: #74083) +--SKIPIF-- +<?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +?> +--FILE-- +<?php + +require_once "tester.inc"; + +$cfg = <<<EOT +[global] +error_log = {{FILE:LOG}} +pid = {{FILE:PID}} +process_control_timeout=1 +[unconfined] +listen = {{ADDR}} +ping.path = /ping +ping.response = pong +pm = dynamic +pm.max_children = 5 +pm..start_servers = 1 +pm.min_spare_servers = 1 +pm.max_spare_servers = 1 +EOT; + +$code = <<<EOT +<?php +/* empty */ +EOT; + +$tester = new FPM\Tester($cfg, $code); +$tester->start(); +$tester->expectLogStartNotices(); +$tester->ping('{{ADDR}}'); + +/* Vary interval between concurrent reload requests + since performance of test instance is not known in advance */ +$max_interval = 25000; +$step = 1000; +$pid = $tester->getPid(); +for ($interval = 0; $interval < $max_interval; $interval += $step) { + exec("kill -USR2 $pid", $out, $killExitCode); + if ($killExitCode) { + echo "ERROR: master process is dead\n"; + break; + } + usleep($interval); +} +echo "Reached interval $interval us with $step us steps\n"; +$tester->expectLogNotice('Reloading in progress ...'); +/* Consume mix of 'Reloading in progress ...' and 'reloading: .*' */ +$tester->getLogLines(2000); + +$tester->signal('USR2'); +$tester->expectLogNotice('Reloading in progress ...'); +$tester->expectLogNotice('reloading: .*'); +$tester->expectLogNotice('using inherited socket fd=\d+, "127.0.0.1:\d+"'); +$tester->expectLogStartNotices(); +$tester->ping('{{ADDR}}'); + +$tester->terminate(); +$tester->expectLogTerminatingNotices(); +$tester->close(); + +?> +Done +--EXPECT-- +Reached interval 25000 us with 1000 us steps +Done +--CLEAN-- +<?php +require_once "tester.inc"; +FPM\Tester::clean(); +?>

« previous php.cvs (#108976) next »