Merge conflict Gerrit cannot merge this change. It needs a rebase onto main.

Review main Work in progress

97533[FEATURE] Use symfony/lock for locking

Benni Mack CR 0 V 0 Expert +884 −152 updated 11/11/26, 12:20

Commit message

TYPO3's own locking API only works on a single host: page generation
and image processing locks have no effect across several web nodes
or containers, the file strategy fails on NFS, and locks never
expire when the process holding them dies.

symfony/lock is required now. The new LockProvider creates its locks,
backed by a store configured as DSN in
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locking']['store'], with optional
per-scope overrides in ['SYS']['locking']['stores']. The default
"flock" keeps the lock files in var/lock/ as before. LockProvider and
Symfony's LockFactory are registered in the core ServiceProvider, so
they are available in the failsafe container as well.

ResourceMutex replaces its access lock and 20ms polling loop with a
single lock. As FlockStore never deletes lock files, keys are mapped
onto 1024 locks per scope to keep the number of files bounded. Pages
sharing a lock only wait for each other: the waiting process checks
the page cache again and renders the page if it is still missing.
Image processing uses the readable scope "image-processing" instead
of its class name.

LanguagePackStatesStore, CommandLineUserCreation, MboxTransport and
RotatingFileWriter use LockProvider. LanguagePackStatesStore reads
under a shared lock, the mbox lock is per mbox file.

No logger is attached to the lock factories, since log writers lock
as well and would end up locking recursively.

LockFactory, LockingStrategyInterface, the three strategies, their
exceptions and the "strategies" configuration are deprecated.

Stores backed by a database table are not supported yet, as their
table is not part of the TYPO3 database schema.

With the default "flock" store, LockProvider checks once per request
whether files in var/lock/ can be locked, which fails on network file
systems like NFS. It then falls back to semaphores if "sysvsem" is
available and logs a warning. The warning is logged after the lock
factory is registered, so that a log writer locking again does not
run into the same check. Configuring any other store skips the check.

Test this change

Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch

Check out patch set 1
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/33/97533/1 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/33/97533/1 && git cherry-pick FETCH_HEAD

Review

  • Code review CR 0 Needs a vote
  • Verified V 0 Needs a vote
    • core-ci +1 CI

Issues 2

Files 33

Show 13 more files

Review log 12

  1. Benni Mack uploaded patch set 1 11/11/26, 08:58

  2. core-ci voted on patch set 1 V +1 11/11/26, 09:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/114023