Hi list. We log all errors that happens in our production environment, but as fatal errors can't be handled from within php, we end up with little 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 timeouts (zend_timeout), I raise a WARNING, sleep for 1 second and then resume normal behavior, which results in a fatal error. This gives userland code 1 second to log the error somewhere, which should be sufficient for debugging.
Would like to get feedback as to if this has any hidden problems, but otherwise I propose that it's included in the project. -- troels
--- ./Zend/zend_execute_API.c.orig 2010-03-22 15:33:17.000000000 +0100 +++ ./Zend/zend_execute_API.c 2010-03-22 15:33:01.000000000 +0100 @@ -1302,6 +1302,9 @@ ZEND_API void zend_timeout(int dummy) /* {{{ */ { + zend_error(E_WARNING, "Maximum execution time of %d second%s exceeded. Execution will shut down in 1 second.", EG(timeout_seconds), EG(timeout_seconds) == 1 ? "" : "s"); + sleep(1); + TSRMLS_FETCH(); if (zend_on_timeout) {
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php