Project

General

Profile

Actions

Bug #40420

closed

Semaphore based locking returns warning

Added by Rudi Meyer about 12 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
Start date:
2012-08-30
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
4.6
PHP Version:
5.3
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

When using the 'semaphore' type locking functionality, sem_acquire return warning when identifier is released in another parallel request.

Example:
Core: Error handler (FE): PHP Warning: sem_acquire(): failed to acquire key 0x91b615ca: Identifier removed in /var/www/lib/typo3_src-4.6/t3lib/class.t3lib_lock.php line 211.

Is I understand it the flow is as following:

1. Request #1 is received.
2. sem_get is called with "id" as key
3. sem_acquire acquires semaphore with identifier from sem_get
4. Page generation begins
5. Request #2 is received
6. Request #2 sem_gets with "id" as key
7. Request #2 start loop on sem_acquire until it gets a lock
8. Request #1 completes, releases lock and removed identifier
9. Request #2 can't acquire, identifier is gone.

This could be considered similar to the unlink issue with the 'standard' locking method: http://forge.typo3.org/issues/32282 - the solution could be the same, adding a '@'...?


Files

class.t3lib_lock.php.patch (488 Bytes) class.t3lib_lock.php.patch Rudi Meyer, 2012-09-03 14:19

Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #32282: typo3temp/locks warning. unlink function returns warningClosed2011-12-03

Actions
Related to TYPO3 Core - Bug #69936: Semaphore locking: PHP hangs with 3 concurrent requestsClosed2015-09-18

Actions
Actions #1

Updated by Rudi Meyer about 12 years ago

Here is my suggestion for a fix, I've gone with the same strategy as in http://forge.typo3.org/issues/32282, that is ignoring the warning. We know it will occur, we know why and we kinda don't care.

The patch is doable on both 4.5, 4.6 and 4.7 since no work has been done on 'class.t3lib_lock.php' in that time.

Actions #2

Updated by Markus Klein over 10 years ago

  • Is Regression set to No

Hi Rudi!

This can only be solved cleanly by keeping a count on how many processes are currently having this semaphore.
The last one remaining has to remove the semaphore then.

This would of course require some shared memory or a file to store the number of processes. That takes time.

So my suggestion would be to NOT remove the the semaphore at all. Usually the same IDs are requested over and over again, so that shouldn't be a problem.
Although on heavy load this might cause issues with maximum resources available in the OS.

If that is the case, we've to implement shared memory.

What do you think?

Actions #3

Updated by Gerrit Code Review over 10 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28159

Actions #4

Updated by Gerrit Code Review over 10 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28159

Actions #5

Updated by Gerrit Code Review over 10 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28159

Actions #6

Updated by Gerrit Code Review over 10 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28159

Actions #7

Updated by Gerrit Code Review over 10 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28159

Actions #8

Updated by Gerrit Code Review over 10 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28159

Actions #9

Updated by Gerrit Code Review over 10 years ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28159

Actions #10

Updated by Gerrit Code Review over 10 years ago

Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28159

Actions #11

Updated by Gerrit Code Review over 10 years ago

Patch set 9 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28159

Actions #12

Updated by Gerrit Code Review over 10 years ago

Patch set 10 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28159

Actions #13

Updated by Gerrit Code Review over 10 years ago

Patch set 11 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28159

Actions #14

Updated by Gerrit Code Review over 10 years ago

Patch set 12 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28159

Actions #15

Updated by Gerrit Code Review over 10 years ago

Patch set 13 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28159

Actions #16

Updated by Gerrit Code Review over 10 years ago

Patch set 14 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28159

Actions #17

Updated by Gerrit Code Review over 10 years ago

Patch set 15 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28159

Actions #18

Updated by Gerrit Code Review over 10 years ago

Patch set 16 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28159

Actions #19

Updated by Gerrit Code Review over 10 years ago

Patch set 17 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28159

Actions #20

Updated by Gerrit Code Review over 10 years ago

Patch set 18 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28159

Actions #21

Updated by Markus Klein over 10 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #22

Updated by Riccardo De Contardi about 7 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF