bug77023-pm-dynamic-blocking-sigquit.phpt 1.5 KB

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