Bug #77603 [NEW]: Unexpected behavior with reloading php-fpm and sleep method

From: Date: Mon, 11 Feb 2019 11:53:10 +0000
Subject: Bug #77603 [NEW]: Unexpected behavior with reloading php-fpm and sleep method
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-219500@lists.php.net to get a copy of this message
From: aliborhani1 at gmail dot com Operating system: Ubuntu 18.04.2 LTS PHP version: 7.3.2 Package: FPM related Bug Type: Bug Bug description:Unexpected behavior with reloading php-fpm and sleep method 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 -- Edit bug report at https://bugs.php.net/bug.php?id=77603&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77603&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77603&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77603&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=77603&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=77603&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=77603&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=77603&r=needscript Try newer version: https://bugs.php.net/fix.php?id=77603&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=77603&r=support Expected behavior: https://bugs.php.net/fix.php?id=77603&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=77603&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=77603&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=77603&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77603&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=77603&r=dst IIS Stability: https://bugs.php.net/fix.php?id=77603&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=77603&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=77603&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=77603&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=77603&r=mysqlcfg

« previous php.bugs (#219500) next »