Project

General

Profile

Actions

Bug #69936

closed

Semaphore locking: PHP hangs with 3 concurrent requests

Added by Christian Weiske about 9 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2015-09-18
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.4
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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".


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #40420: Semaphore based locking returns warningClosed2012-08-30

Actions
Actions #1

Updated by Markus Klein almost 9 years ago

I agree that removing a semaphore is not a good idea in the setting of how PHP scripts work.
After having rewritten the API for CMS 7, we improved a lot in the locking area (also in the usage of locks in FE rendering), so we didn't even test the old API any longer.

I would be fine with removing this call, but I fear you run into other troubles then, as the FE rendering locking in the 6.2 implementation might create quite some semaphores, which could hit the limit of semaphores of the OS.

My personal suggestion is to really avoid using semaphore locking with PHP at all.

Actions #2

Updated by Riccardo De Contardi about 8 years ago

  • Status changed from New to Closed

This should be already fixed for v.7+;
sorry but that won't be fixed for lower versions as the change would be too big (TYPO3 6.2 is in priority bugfix mode).

If you think that this is the wrong decision or experience the issue again or that there is further work to do on this topic, please reopen this issue or open a new issue with a reference to this one.

Thank you

Actions

Also available in: Atom PDF