Bug #63087

Shared locks cannot be released

Added by Ludwig Rafelsberger almost 7 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Must have
Category:
-
Target version:
-
Start date:
2014-11-19
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:

Description

Shared locks using \TYPO3\CMS\Core\Locking\Locker::LOCKING_METHOD_FLOCK can not be released using Locker::release(). (Instead, they will be forcefully released on object destruction, e.g. on request shutdown.)

It seems that the default installation does not require releasing of shared locks, but there are use-cases in which a shared lock must be properly released during a request.

My problematic locking sequence is:
  • acquire shared lock
  • test: is (expensive) resource X cheaply available (cache)?
    • if yes:
      • use it
      • release shared lock
    • if not:
      • release shared lock and acquire exclusive lock (we are going to write soon)
        Obtaining the exclusive lock involves waiting for every other
        lock – shared or exclusive, and especially including our "own" shared one
        from the steps before – to be released
      • repeat the initial test for [cheap variant of] resource X
        (Someone else could have gone through the same process and obtained an
        exclusive lock before us, writing the cheap (cache) variant and superseding
        the need to get the (expensive) resource now.)
        • yes:
          • use it
          • release exclusive lock
        • no:
          • obtain (expensive) resource X
          • store it (cache)
          • use it
          • release exclusive lock

All lock operations marked either bold or italic, with bold being the ones that make my process stuck.

Also available in: Atom PDF