Please help me figure out if this fix causes any weird side-effects
anywhere. Essentially the problem is that the new deferred signals
patch ignores signals when running signal handlers. But since
register shutdown functions are called by the signal handler they
won't time out anymore. By pretending not to be running a signal
handler when we call the shutdown functions we can re-enable timeouts
here.

On 09/07/2011 11:48 AM, Rasmus Lerdorf wrote:
> rasmus                                   Wed, 07 Sep 2011 18:48:17 +0000
> 
> Revision: http://svn.php.net/viewvc?view=revision&revision=316382
> 
> Log:
> Make timeouts work again for shutdown functions.
> Fixes the faling lang/045 test
> 
> Changed paths:
>     U   php/php-src/branches/PHP_5_4/Zend/zend_execute_API.c
>     U   php/php-src/trunk/Zend/zend_execute_API.c
> 
> Modified: php/php-src/branches/PHP_5_4/Zend/zend_execute_API.c
> ===================================================================
> --- php/php-src/branches/PHP_5_4/Zend/zend_execute_API.c      2011-09-07 
> 18:47:22 UTC (rev 316381)
> +++ php/php-src/branches/PHP_5_4/Zend/zend_execute_API.c      2011-09-07 
> 18:48:17 UTC (rev 316382)
> @@ -1328,6 +1328,13 @@
>       TSRMLS_FETCH();
> 
>       if (zend_on_timeout) {
> +             /*
> +                We got here because we got a timeout signal, so we are in a 
> signal handler
> +                at this point. However, we want to be able to timeout any 
> user-supplied
> +                shutdown functions, so pretend we are not in a signal 
> handler while we are
> +                calling these
> +             */
> +             SIGG(running) = 0;
>               zend_on_timeout(EG(timeout_seconds) TSRMLS_CC);
>       }
> 
> 
> Modified: php/php-src/trunk/Zend/zend_execute_API.c
> ===================================================================
> --- php/php-src/trunk/Zend/zend_execute_API.c 2011-09-07 18:47:22 UTC (rev 
> 316381)
> +++ php/php-src/trunk/Zend/zend_execute_API.c 2011-09-07 18:48:17 UTC (rev 
> 316382)
> @@ -1328,6 +1328,13 @@
>       TSRMLS_FETCH();
> 
>       if (zend_on_timeout) {
> +             /*
> +                We got here because we got a timeout signal, so we are in a 
> signal handler
> +                at this point. However, we want to be able to timeout any 
> user-supplied
> +                shutdown functions, so pretend we are not in a signal 
> handler while we are
> +                calling these
> +             */
> +             SIGG(running) = 0;
>               zend_on_timeout(EG(timeout_seconds) TSRMLS_CC);
>       }
> 
> 
> 
> 
> 


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to