From: Nikita Popov Date: Mon, 11 May 2020 13:05:01 +0000 (+0200) Subject: Don't reset SIGG(running) when calling zend_on_timeout X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5d93eab6207614d44378f0034656cf382963244b;p=php Don't reset SIGG(running) when calling zend_on_timeout This is only an internal callback nowadays and does not actually run any user code. It must be async signal safe. --- diff --git a/Zend/zend.c b/Zend/zend.c index 40dd8991a1..e20a26f8b0 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -83,6 +83,7 @@ ZEND_API int (*zend_post_startup_cb)(void) = NULL; ZEND_API void (*zend_post_shutdown_cb)(void) = NULL; ZEND_API int (*zend_preload_autoload)(zend_string *filename) = NULL; +/* This callback must be signal handler safe! */ void (*zend_on_timeout)(int seconds); static void (*zend_message_dispatcher_p)(zend_long message, const void *data); diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index d98db72fba..bbd7bb8f8b 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -1164,15 +1164,6 @@ static void zend_timeout_handler(int dummy) /* {{{ */ #endif if (zend_on_timeout) { -#ifdef ZEND_SIGNALS - /* - 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; -#endif zend_on_timeout(EG(timeout_seconds)); } @@ -1216,13 +1207,13 @@ static void zend_set_timeout_ex(zend_long seconds, int reset_signals) /* {{{ */ #ifdef ZEND_WIN32 zend_executor_globals *eg; - if(!seconds) { + if (!seconds) { return; } - /* Don't use ChangeTimerQueueTimer() as it will not restart an expired - timer, so we could end up with just an ignored timeout. Instead - delete and recreate. */ + /* Don't use ChangeTimerQueueTimer() as it will not restart an expired + * timer, so we could end up with just an ignored timeout. Instead + * delete and recreate. */ if (NULL != tq_timer) { if (!DeleteTimerQueueTimer(NULL, tq_timer, INVALID_HANDLE_VALUE)) { tq_timer = NULL;