Issue Bug Closed

#69936Semaphore locking: PHP hangs with 3 concurrent requests

Christian Weiske 09/18/15, 10:56 updated 10/18/16, 13:13

Description

We have a TYPO3 6.2 instance running on PHP-CGI 5.4.40 on Debian 7, using semaphore locking.

Doing 3 concurrent requests with apache bench to the frontend index.php page with an empty page cache (or page.config.no_cache=1 in TypoScript) leaves one of the three CGI processes hanging forever using 100% CPU, with the following strace messages:

...
semop(439910402, {{0, -1, SEM_UNDO}}, 1) = -1 EINVAL (Invalid argument)
semop(439910402, {{0, -1, SEM_UNDO}}, 1) = -1 EINVAL (Invalid argument)
...

We found that removing the sem_remove() from the typo3_src/typo3/sysext/core/Classes/Locking/Locker.php destructor solves the issue and we experience no more hanging processes.

This is in line with http://php.net/manual/en/function.sem-remove.php#113540 which states

> sem_remove() shouldn’t be part of a normal cleanup/teardown and should be called very rarely due to bugs in the implementation.

The destructor code was introduced in #40420, “[TASK] Improve Locker”.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.