Re: [PATCH] Raise warning first on "Maximum execution time exceeded"
| From: | Jille Timmermans | Date: | Mon, 22 Mar 2010 16:29:54 +0000 |
| Subject: | Re: [PATCH] Raise warning first on "Maximum execution time exceeded" | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-47460@lists.php.net to get a copy of this message | ||
Op 22-3-2010 17:14, Sufficool, Stanley schreef:
Think outside the engine. The engine dies with a fatal error, set a handler to run another PHP instance. The engine then passes the error object as serialized argv to the handler. set_fatal_handler("fatal_handler.php"); I don't a practical way to continue script execution in any way without causing some issue. The service provider should be able to kill this with a custom error handler set in INI. fatal_handler="mail_fatal.sh" #Log / mail using our script fatal_handler="" # (default) - Don't allow user override #fatal_handler="" # handler undefined / Allow override You can already do that from the shutdown functions. They run even after fatal errors. php -r 'register_shutdown_function(function() { echo "bye"; }); ohcrap();' But the most common request is a backtrace; which can not be generated from the shutdown function; neither from an external script. ("Hey! We could use coredumps for this! That allows post-mortem examination by some external error handler!") -- Jille-----Original Message----- From: Jille Timmermans [mailto:jille@quis.cx] Sent: Monday, March 22, 2010 8:44 AM To: Johannes Schlüter Cc: troels knak-nielsen; PHP Developers Mailing List Subject: Re: [PHP-DEV] [PATCH] Raise warning first on "Maximum execution time exceeded" Op 22-3-2010 16:14, Johannes Schlüter schreef:environment, but asOn Mon, 2010-03-22 at 15:51 +0100, troels knak-nielsen wrote:We log all errors that happens in our productionwith littlefatal errors can't be handled from within php, we end up(zend_timeout),information to go on for further debugging. I'm not very familiar with the php internals code, but I managed to throw in a hack that appears to work. In the handler function for timeoutsuserland code 1I raise a WARNING, sleep for 1 second and then resume normal behavior, which results in a fatal error. This givesafter thesecond to log the error somewhere, which should be sufficient for debugging.A one second delay is no option there. And what actually happens is that the warning triggers your custom error handler. After that it sleeps then it dies. This also creates a "nice" way to extend the script runtimetimeout occurred. aka. making the timeout useless for manyscenariosit was meant for.This could be made configurable. Shared hosting providers probably want to disable the 'overriding' of the timeout. At my work; all code is written by our own developers; so there's no evil in there ;) (And it would be usefull to give extra debugging information)
-- Jille-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.phpjohannes