#17461 [Com]: register_shutdown_function() timeout problem

From: Date: Tue, 17 Sep 2002 16:51:55 +0000
Subject: #17461 [Com]: register_shutdown_function() timeout problem
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-19556@lists.php.net to get a copy of this message
ID: 17461 Comment by: jason@thinkingman.org Reported By: jason@thinkingman.org Status: Open Bug Type: Scripting Engine problem Operating System: Windows 2000 SP2 PHP Version: 4.2.1 New Comment: I posted the following response in php.general and php.windows -- responding to users whom looked at the online help file for REGISTER_SHUTDOWN_FUNCTION() on php.net and inquired whether this TIMEOUT was actually a bug or a feature request: ---------------------------------------------- It's a bug. spoke to Rasmus at some length about just before i posted it in the bug report. The online help page is inaccurate in describing the full functionality of the function: http://www.php.net/manual/en/function.register-shutdown-function.php REGISTER_SHUTDOWN_FUNCTION() is suppose to kick-off when any one of the following things happen -- Exit, Error, TIMEOUT or User Abort. According to Rasmus, the TIMEOUT functionality of this function works fine under Linux -- however, it's not working under Win32 ! There apparently is another bug with this function -- you are suppose to be able to call more than one REGISTER_SHUTDOWN_FUNCTION(), and they are suppose to executed in-order... some people are reporting that only the first encountered REGISTER_SHUTDOWN_FUNCTION() is executed, then the script exits. Someone needs to go through this function, pretty thoroughly, and get it working correctly. Being able to run code on a timeout, user-abort or error is critical. Jason Previous Comments: ------------------------------------------------------------------------ [2002-07-21 14:13:52] jason@thinkingman.org Don't mean to be a nag... I know there are other issues you programming gods are working on... however, I was just wondering if anyone is working on this REGISTER_SHUTDOWN_FUNCTION() TIMEOUT case? -- I noticed the case has been marked "OPEN" -- not sure if that means someone is working on it, though... I'd love to see this fixed in the next minor release of PHP, 4.2.2 ?? Thanks. Jason ------------------------------------------------------------------------ [2002-07-15 16:16:07] jason@thinkingman.org Please note -- there was a type-o in my email address: my correct email address is jason@thinkingman.org (not, jason@thinkingmna.org) ;-) ------------------------------------------------------------------------ [2002-05-27 14:11:04] jason@thinkingman.org REGISTER_SHUTDOWN_FUNCTION() doesn't work on TIMEOUT for the Win32 platform. I've tried this under PHP versions 4.1.1 and 4.2.1 -- same thing happens. Here's a sample script: 1: ?> 2: 3: set_time_limit(1); 4: 5: function clean_up() 6: { 7: print("Script Terminated\n"); 8: } 9: 10: register_shutdown_function("clean_up"); 11: 12: while(1); 13: 14: ?> Here's the error: ----------------- Fatal error: Maximum execution time of 1 second exceeded in C:\timeout_code.php on line 7 When this script TIMES-OUT, the REGISTER_SHUTDOWN_FUNCTION() will "attempt" to run the function "clean_up" but will *immediately* generate the error above in the 1st line (line 7, in this case) of the "clean_up" function -- no matter what it is, and then the script terminates. Now -- if I use the REGISTER_SHUTDOWN_FUNCTION() with an EXIT (instead of a TIMEOUT), the function works fine... it *just* seems to be a TIMEOUT issue. The REGISTER_SHUTDOWN_FUNCTION() needs to ignore the TIMEOUT (timer??) -- and proceed to run any code it's programmed to run. Just a Note: I understand that PRINT() and a few other functions will not work when a REGISTER_SHUTDOWN_FUNCTION() is called and *run* SERVER-SIDE -- however, I am running this script from the COMMAND-LINE and PRINT() does work here, even with a REGISTER_SHUTDOWN_FUNCTION() -- so PRINT() isn't the problem... Just for giggles, I've replaced the PRINT() function with an ERRORLOG() function, in an attempt to write the output to disk -- SAME ERROR and exits on line 7 -- never executing the code. Thanks Jason Caldwell jason@thinkingman.org ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=17461&edit=1

« previous php.bugs (#19556) next »