[php-src] PR #13027: Fix signal leak in max execution timers
| From: | withinboredom | Date: | Mon, 25 Dec 2023 23:47:26 +0000 |
| Subject: | [php-src] PR #13027: Fix signal leak in max execution timers | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-24601@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/13027
Author: withinboredom
This is a fix for https://github.com/dunglas/frankenphp/issues/440,
which does two things:
1. Ensures only a single timer/handler is registered per thread (only applicable to ZTS builds).
2. Registers
SIG_IGN on the timer signal to release the signal from SigQ.
(1) is especially important in ZTS builds because ts_resource() and
php_request_startup() both eventually call
zend_max_execution_timer_init(), which can result in a leak of signals.
Note:
This is using a thread-local variable to enforce a single registration per thread. I suspect there
is probably a more idiomatic way to this, so any suggestions on how to do this better would be
appreciated.