Skip to content

opcache + MPM ITK might cause apache2 to hang #9910

Open
@diab303

Description

@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 - mind04/mod-ruid2#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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions