[php-src] Issue #9910: opcache + MPM ITK might cause apache2 to hang
| From: | diab303 | Date: | Wed, 09 Nov 2022 14:24:06 +0000 |
| Subject: | [php-src] Issue #9910: opcache + MPM ITK might cause apache2 to hang | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242773@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9910
Author: diab303
### Description
This is referring to the bug that is present since at least 5.6. It still happens in 7.4 (just
confirmed) and the same code is present in 8.x so I assume the behaviour is the same there, too.
Apache + PHP + MPM_ITK hangs at random intervals spamming "Cannot kill process" in the
apache error log.
The original bug report is here: https://bugs.php.net/bug.php?id=76482
The fix looks pretty trivial (break the loop when kill fails) but I'm not sure if it would
cause other problems.
Quoting the bug history:
> It was reported in 5.6.36 but the bug is in 7.1 (reproduced here) and by looking into source
> code also in current 7.3 branch.
>Not only mpm itk is affected but any MPM which switches child processes to different UIDs (via
>setuid()). Other example is mod_ruid2 -
>https://github.com/mind04/mod-ruid2/issues/17
>kill_all_lockers() has a loop which never ends if killing fails
as kill(mem_usage_check->l_pid, SIGKILL) returns EPERM in errno.
>There is
```
if (!success) {
/* errno is not ESRCH or we ran out of tries to kill the locker */
ZCSG(force_restart_time) = time(NULL); /* restore forced restart request */
/* cannot kill the locker, bail out with error */
zend_accel_error(ACCEL_LOG_ERROR, "Cannot kill process %d: %s!",
mem_usage_check->l_pid, strerror(errno));
}
```
>but it doesn't break the loop. Is brake missing here?
### PHP Version
PHP 7.4
### Operating System
Debian 11