#21513 [Com]: shutdown functions not executed if timed out
| From: | ceeam at mail dot ru | Date: | Wed, 22 Jan 2003 08:09:50 +0000 |
| Subject: | #21513 [Com]: shutdown functions not executed if timed out | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-30903@lists.php.net to get a copy of this message | ||
ID: 21513
Comment by: ceeam@mail.ru
Reported By: ceeam@mail.ru
Status: Feedback
Bug Type: Scripting Engine problem
Operating System: WinXP
PHP Version: 4.3.0
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2003-01-20 22:47:06] sniper@php.net
And this is related to http://bugs.php.net/bug.php?id=14542
(and maybe to http://bugs.php.net/bug.php?id=14251 ?)
------------------------------------------------------------------------
[2003-01-20 22:44:38] 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-08 02:53:17] ceeam@mail.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.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=21513&edit=1