|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2023-12-08 12:29 UTC] bukka@php.net
-Summary: Unexpected behavior with reloading php-fpm
and sleep method
+Summary: Continued sleep after signal interruption
-Type: Bug
+Type: Feature/Change Request
-Package: FPM related
+Package: Program Execution
-Assigned To:
+Assigned To: bukka
[2023-12-08 12:29 UTC] bukka@php.net
[2023-12-08 12:33 UTC] bukka@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 07:00:01 2025 UTC |
Description: ------------ When I use sleep() method in my script and set `process_control_timeout` to `20s` in php-fpm.conf, I see unexpected behavior when I reload the php-fpm. It seems it doesn't respect the sleep's argument (e.g. 10 seconds) and wakes up the script too early. However, when I use `exec('sleep 10')` instead, it works correctly: ``` [02-11-2019 11:39:15] before sleep [02-11-2019 11:39:25] after sleep [02-11-2019 11:39:25] after echo ``` PHP Version: PHP 7.3.2-3+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Feb 8 2019 15:43:57) ( NTS ) Webserver: Nginx - using unix socket Test script: --------------- <?php slog("before sleep"); // this works: // exec('sleep 10'); // but, this doesn't work: sleep(10); slog("after sleep"); echo "Done!" . PHP_EOL; slog("after echo"); function slog(string $text) { $text = '[' . strftime("%m-%d-%Y %H:%M:%S") . '] ' . $text . PHP_EOL; file_put_contents(__DIR__ . '/app.log', $text, FILE_APPEND); } Expected result: ---------------- [02-11-2019 11:38:43] before sleep [02-11-2019 11:38:53] after sleep [02-11-2019 11:38:53] after echo Actual result: -------------- [02-11-2019 11:38:43] before sleep [02-11-2019 11:38:46] after sleep [02-11-2019 11:38:46] after echo