Bug #69936
closedSemaphore locking: PHP hangs with 3 concurrent requests
0%
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".