TYPO3 v8.7 Bad Performance issue Lock Acquire

We are detecting several issue regarding php flock. (PHP: flock - Manual)

It’s took too much time, in every pages… and it’s coming from Typo3 Source Code v.8.7 Long Time Support without any mods.

LockStrategy Source Code from: web/typo3/sysext/core/Classes/Locking/FileLockStrategy.php

  • @param int $modTransaction tracee LOCK_CAPABILITY_EXCLUSIVE or LOCK_CAPABILITY_SHARED or self::LOCK_CAPABILITY_NOBLOCK * @return bool Returns TRUE if the lock was acquired successfully * @throws LockAcquireException if the lock could not be acquired * @throws LockAcquireWouldBlockException if the acquire would have blocked and NOBLOCK was set */ public function acquire($mode = self::LOCK_CAPABILITY_EXCLUSIVE) { if ($this->isAcquired) { return true; } $this->filePointer = fopen($this->filePath, ‘c’); if ($this->filePointer === false) { throw new LockAcquireException(‘Lock file could not be opened’, 1294586099); } GeneralUtility::fixPermissions($this->filePath); $operation = $mode & self::LOCK_CAPABILITY_EXCLUSIVE ? LOCK_EX : LOCK_SH; if ($mode & self::LOCK_CAPABILITY_NOBLOCK) { $operation |= LOCK_NB; } $wouldBlock = 0; $this->isAcquired = flock($this->filePointer, $operation, $wouldBlock); if (!$this->isAcquired) { // Make sure to cleanup any dangling resources for this process/thread, which are not needed any longer fclose($this->filePointer); } if ($mode & self::LOCK_CAPABILITY_NOBLOCK && !$this->isAcquired && $wouldBlock) { throw new LockAcquireWouldBlockException(‘Failed to acquire lock because the request would block.’, 1428700748); } return $this->isAcquired; }

We register it on four different istances on new relic. Do you have any hints to investage?

We already deleted typo3temp/var/locks/ f and flush the caches without results.

The problem started this morning 10:15 am on every machine.

Best Regards,

We rebooted every single docker, mainly 7.4.27 and nginx without lock.
After rebooting every instances (Redhat on AWS) the flock restarted to performs good.
What could impact so badly the flock performances?
Our cpu and ram was pretty low.
Best Regards,