PHP :: Bug #21513 :: shutdown functions not executed if timed out
- ️Wed Jan 08 2003
Bug #21513 | shutdown functions not executed if timed out | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Submitted: | 2003-01-08 02:53 UTC | Modified: | 2004-01-19 04:52 UTC |
|
||||||||||
From: | ceeam at mail dot ru | Assigned: | zeev (profile) | |||||||||||
Status: | Closed | Package: | Scripting Engine problem | |||||||||||
PHP Version: | 4CVS, 5CVS | OS: | win32 (only) | |||||||||||
Private report: | No | CVE-ID: | None |
[2003-01-08 02:53 UTC] ceeam at mail dot ru
This problem is absolutely critical if you do DB cleanups, transactions processing or other similar things in shutdown functions. Can be especially bad if you need to commit/rollback transactions with persistent DB connections. ---------- <?php function boo() { ...do_anything...; // never ever gets called } register_shutdown_function("boo"); set_time_limit(3); // not necessary, just to show the error sooner for (;;) { // infinite loop to simulate long processing } ?> ---------- Error message: Fatal error: Maximum execution time of 3 seconds exceeded in c:\exp.php on line 10 Fatal error: Maximum execution time of 3 seconds exceeded in c:\exp.php on line 4 Does not depend on whether we run script as CGI/SAPI or CLI. Report #14542 looks similar but is different IMHO.
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commitsRelated reports
[2003-01-20 22:44 UTC] sniper@php.net
This script works just fine for me (using CLI): <?php error_log ("Start\n", 3, "test.log"); function boo() { error_log ("Shutdown - function 'foo'\n", 3, "test.log"); } register_shutdown_function("boo"); /* not necessary, just to show the error sooner */ set_time_limit(1); /* infinite loop to simulate long processing */ for (;;) {} error_log ("\nEnd\n", 3, "test.log"); ?> In test.log I have now: ----cut---- Start Shutdown - function 'foo' ----cut---- Which is the expected output. Can you try this script?
[2003-01-22 02:09 UTC] ceeam at mail dot ru
sniper@php.net: > This script works just fine for me (using CLI): > [skipped] I tested your script. The output is: PHP Fatal error: Maximum execution time of 1 second exceeded in c:\exp.php on line 16 PHP Fatal error: Maximum execution time of 1 second exceeded in c:\exp.php on line 7 "test.log" contains only one "Start" line. I tried with both my own (pretty much cleaned up) php.ini and "recommended" php.ini. I suspect it is only Windows-related problem.
[2003-01-22 22:44 UTC] sniper@php.net
I can not reproduce this with PHP CGI/CLI/Apache DSO, but Steph tested the script under windows and got the same results as ceeam@mail.ru did so this is definately a windows-only bug.
[2004-01-19 04:52 UTC] zeev@php.net
This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better.
[2004-02-12 13:07 UTC] xuefer at 21cn dot com
compiled under cygwin [Xuefer php4]$ ./sapi/cli/php.exe -v PHP 4.3.5RC3-dev (cli) (built: Feb 13 2004 01:29:25) Copyright (c) 1997-2004 The PHP Group Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies [Xuefer php4]$ make test ......... PASS Testing register_shutdown_function() [tests/func/005.phpt] <<- freeze here it's running 005a.phpt [Xuefer php4]$ sapi/cli/php -d max_execution_time=1 -r 'set_time_limit(1); for(;;) {}' [Xuefer php4]$ sapi/cli/php test/func/005a.phpt both is frozen