1--TEST-- 2Concurrent reload signals should not kill PHP-FPM master process. (Bug: #74083) 3--SKIPIF-- 4<?php 5include "skipif.inc"; 6if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); 7?> 8--FILE-- 9<?php 10 11require_once "tester.inc"; 12 13$cfg = <<<EOT 14[global] 15error_log = {{FILE:LOG}} 16pid = {{FILE:PID}} 17process_control_timeout=1 18[unconfined] 19listen = {{ADDR}} 20ping.path = /ping 21ping.response = pong 22pm = dynamic 23pm.max_children = 5 24pm.start_servers = 1 25pm.min_spare_servers = 1 26pm.max_spare_servers = 1 27EOT; 28 29$code = <<<EOT 30<?php 31/* empty */ 32EOT; 33 34$tester = new FPM\Tester($cfg, $code); 35$tester->start(); 36$tester->expectLogStartNotices(); 37$tester->ping('{{ADDR}}'); 38 39/* Vary interval between concurrent reload requests 40 since performance of test instance is not known in advance */ 41$max_interval = 25000; 42$step = 1000; 43$pid = $tester->getPid(); 44for ($interval = 0; $interval < $max_interval; $interval += $step) { 45 exec("kill -USR2 $pid", $out, $killExitCode); 46 if ($killExitCode) { 47 echo "ERROR: master process is dead\n"; 48 break; 49 } 50 usleep($interval); 51} 52echo "Reached interval $interval us with $step us steps\n"; 53$tester->readAllLogNotices('Reloading in progress ...'); 54 55$tester->reload(); 56$tester->expectLogReloadingNotices(); 57$tester->ping('{{ADDR}}'); 58$tester->terminate(); 59$tester->expectLogTerminatingNotices(); 60$tester->close(); 61 62?> 63Done 64--EXPECT-- 65Reached interval 25000 us with 1000 us steps 66Done 67--CLEAN-- 68<?php 69require_once "tester.inc"; 70FPM\Tester::clean(); 71?> 72