You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ZTS with --disable-zend-signals: execution timeout delivered to a non-PHP thread is lost and kills the process #25548
On a ZTS build configured with --disable-zend-signals, the execution timeout signal can be delivered to a thread that never ran PHP, such as a libdispatch worker on macOS. zend_timeout_handler() then prints a message and returns without setting EG(timed_out), so the timeout is lost. The handler is installed with SA_RESETHAND, so the signal's disposition is back to SIG_DFL and the next one terminates the process.
The script below needs zend_test_raise_on_foreign_thread(), which GH-25542 adds to zend_test. It raises the signal on a new thread, which makes the delivery deterministic.
Resulted in this output (5 of 5 runs, process terminated by SIGALRM):
zend_timeout_handler() called in a thread not managed by PHP. The expected signal handler will not be called. This is probably a bug.
But I expected this output instead:
Fatal error: Maximum execution time of 1 second exceeded in %s on line %d
With zend signals enabled, GH-25542 forwards the signal to the PHP thread and the script produces the expected fatal error. Without zend signals, only pcntl_signal_handler() forwards. zend_timeout_handler() does not, so this configuration is not covered.
SIGALRM is the timeout signal on macOS arm64. I have only tested this platform.
PHP Version
PHP-8.4 branch (8.4.29-dev), debug ZTS build with --disable-zend-signals, with GH-25542 applied for the test helper
Fix proposed in #25581, on top of #25580. The timer signal is re-routed the same way, the timeout handler no longer uses SA_RESETHAND under ZTS, and a PHP thread without a timeout ignores a stale timer signal.
Activity
Fix phpGH-25548: execution timeout on a thread that never ran PHP
phcorp commentedon Nov 18, 2026
GH-25542 now includes a fix for this issue, with a regression test.
Fix phpGH-25548: execution timeout on a thread that never ran PHP
Fix phpGH-25548: execution timeout on a thread that never ran PHP
phcorp commentedon Nov 19, 2026
Fix proposed in #25581, on top of #25580. The timer signal is re-routed the same way, the timeout handler no longer uses
SA_RESETHANDunder ZTS, and a PHP thread without a timeout ignores a stale timer signal.Fix phpGH-25548: Execution timeout on a thread that never ran PHP is …
Fix phpGH-25548: Execution timeout on a thread that never ran PHP is …
Fix phpGH-25548: Execution timeout on a thread that never ran PHP is …
Skip the phpGH-25548 tests where signals are not re-routed