1--TEST-- 2FPM: Blocked SIGQUIT prevents idle process to be killed 3--EXTENSIONS-- 4pcntl 5--SKIPIF-- 6<?php 7include "skipif.inc"; 8if (!function_exists('pcntl_sigprocmask')) die('skip Requires pcntl_sigprocmask()'); 9if (!getenv("FPM_RUN_RESOURCE_HEAVY_TESTS")) die("skip resource heavy test"); 10if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request'); 11?> 12--FILE-- 13<?php 14 15require_once "tester.inc"; 16 17$cfg = <<<EOT 18[global] 19error_log = {{FILE:LOG}} 20pid = {{FILE:PID}} 21[unconfined] 22listen = {{ADDR}} 23pm.status_path = /status 24pm = dynamic 25pm.max_children = 2 26pm.start_servers = 1 27pm.min_spare_servers = 1 28pm.max_spare_servers = 1 29EOT; 30 31$code = <<<EOT 32<?php 33pcntl_sigprocmask(SIG_BLOCK, [SIGQUIT, SIGTERM]); 34usleep(300000); 35EOT; 36 37 38$tester = new FPM\Tester($cfg, $code); 39$tester->start(extensions: ['pcntl']); 40$tester->expectLogStartNotices(); 41$tester->multiRequest(2); 42$tester->status([ 43 'total processes' => 2, 44]); 45// wait for process to be killed 46sleep(7); 47$tester->expectLogWarning('child \\d+ exited on signal 9 \\(SIGKILL\\) after \\d+.\\d+ seconds from start', 'unconfined'); 48$tester->expectLogNotice('child \\d+ started', 'unconfined'); 49$tester->expectLogWarning('child \\d+ exited on signal 9 \\(SIGKILL\\) after \\d+.\\d+ seconds from start', 'unconfined'); 50$tester->expectLogNotice('child \\d+ started', 'unconfined'); 51$tester->status([ 52 'total processes' => 1, 53]); 54$tester->terminate(); 55$tester->expectLogTerminatingNotices(); 56$tester->close(); 57 58?> 59Done 60--EXPECT-- 61Done 62--CLEAN-- 63<?php 64require_once "tester.inc"; 65FPM\Tester::clean(); 66?> 67