Bug #72074

FileLockStrategy fails on NFS folders

Added by Dmitry Dulepov about 3 years ago. Updated 9 days ago.

Status:
New
Priority:
Must have
Assignee:
-
Category:
Locking / Session Handling
Target version:
-
Start date:
2015-12-06
Due date:
% Done:

0%

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

Description

FileLockStrategy assumes it can always lock exclusively but fails on NFS mounts (example: vagrant environment). There should be a check that exclusive lock is possible before the capability is reported.

The result of the error is the exception:

#1294586098: Could not acquire access lock for "pagesection"" 

RuntimeException thrown in file
/home/***/vendor/typo3/cms/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php in line 4921.

7 TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::acquireLock("pagesection", "1::")

/home/***/vendor/typo3/cms/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php:
02357:             // but we protect the access again with a global exclusive lock to avoid race conditions
02358: 
02359:             $this->acquireLock('pagesection', $this->id . '::' . $this->MP);
02360:             //
02361:             // from this point on we're the only one working on that page ($key)

Related issues

Related to TYPO3 Core - Feature #87072: Make locking configurable Under Review 2018-12-04

History

#1 Updated by Gerrit Code Review about 3 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/45154

#2 Updated by Gerrit Code Review about 3 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/45154

#3 Updated by Gerrit Code Review about 3 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/45154

#4 Updated by Wouter Wolters over 2 years ago

  • Status changed from Under Review to New

Patch was abandoned

#5 Updated by Grigori Prokhorov 7 months ago

This issue still persists in TYPO3 8, Ubuntu 18.04.

The provided patch does work (with small adjustments to accommodate the new LOCK_CAPABILITY_NOBLOCK option):

        $capabilities = self::LOCK_CAPABILITY_SHARED;
        $testLock = GeneralUtility::makeInstance(__CLASS__, str_replace('\\', '_', __CLASS__));
        try {
            if ($testLock->acquire(self::LOCK_CAPABILITY_EXCLUSIVE)) {
                $testLock->release();
                $capabilities |= self::LOCK_CAPABILITY_EXCLUSIVE;
            }
            if ($testLock->acquire(self::LOCK_CAPABILITY_NOBLOCK)) {
                $testLock->release();
                $capabilities |= self::LOCK_CAPABILITY_NOBLOCK;
            }
        } catch (\Exception $exception) {
            throw new LockAcquireException($exception->getMessage(), $exception->getCode(), $exception);
        }

#6 Updated by Grigori Prokhorov 7 months ago

  • TYPO3 Version changed from 7 to 8
  • PHP Version set to 7.2
  • Complexity set to easy

#7 Updated by Grigori Prokhorov 7 months ago

  • TYPO3 Version changed from 8 to 7
  • PHP Version deleted (7.2)

#8 Updated by Gerrit Code Review 5 months 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/57514

#9 Updated by Gerrit Code Review 5 months 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/57514

#10 Updated by Sebastien Convers 3 months ago

Gerrit Code Review wrote:

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/57514

Thanks a lot, this patch save my life on Nuxit hosting !! Will it be in 8.7.20 ?

#11 Updated by Markus Klein 3 months ago

@Sebastian Convers: Read my comments in the patch!
The answer is: No, not in this state.

#12 Updated by Sybille Peters 23 days ago

  • Status changed from Under Review to New

Patch was abandoned.

#13 Updated by Sybille Peters 23 days ago

I submitted PR #363 to the documentation. This does not solve this issue, but I think it lessens the severity by adding the information that there may be problems with NFS, gives some information about the locking API and could be extended to address further use cases.

This is one puzzle piece, another could be making locking configurable and adding further locking strategies in the core, I think.

#14 Updated by Sybille Peters 9 days ago

  • Category set to Locking / Session Handling

#15 Updated by Sybille Peters 9 days ago

Also available in: Atom PDF