Review main Work in progress

97589[BUGFIX] Avoid "database is locked" when resolving page slugs

Benni Mack CR 0 V 0 Normal +137 −3 updated 11/18/26, 19:22

Commit message

PageSlugCandidateProvider iterates the result of its page query row
by row and resolves the site of each page within that loop. On a
cold cache this writes the rootline cache, with the default database
backend on the connection whose result is still open.

A result that has not been read to its end keeps the read
transaction of the connection open. On SQLite in WAL mode this pins
the snapshot: once another connection commits, a write on top of the
outdated snapshot is refused with SQLITE_BUSY_SNAPSHOT. SQLite does
not call the busy handler in this case, so the request fails at once
with "database is locked", no matter which busy timeout is set.

All rows are now fetched before the loop, which closes the result
and ends the read transaction before anything is written.

The functional test switches its SQLite connection to WAL mode and
uses a rootline cache backend that lets a second connection commit a
write right before each cache entry is set.

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 3
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/89/97589/3 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/89/97589/3 && git cherry-pick FETCH_HEAD

Review

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

Merge conflicts 1

Issues 1

Files 3

Review log 811

  1. Benni Mack uploaded patch set 1 11/12/26, 20:27

  2. Benni Mack updated the commit message in patch set 2 11/12/26, 20:28

  3. core-ci voted on patch set 1 V +1 11/12/26, 20:35 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/114225

  4. core-ci voted on patch set 2 V +1 11/12/26, 20:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/114226

  5. Markus Klein commented on patch set 2 11/12/26, 21:24

    Are we sure this is only a problem for that specific case? To me this reads like: any concurrent write to longer reads could have the same problem. While it seems reasonable in this case to grab all pages into memory and free the connection, this is not feasible in general, I'd say.
  6. Benni Mack commented on patch set 2 11/13/26, 09:25

    Reply

    it happened while having 3 parallel runs for the e2e tests locally, where I wanted to share an instance and the whole thing failed because of that. the fix is however not just SQLite only...
  7. Simon Schaufelberger voted on patch set 2 CR +1 V +1 11/13/26, 10:13

  8. Benni Mack uploaded patch set 3 CR +1 V +1 11/13/26, 15:33

  9. core-ci voted on patch set 3 V +1 11/13/26, 18:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/114355

  10. Benni Mack marked it work in progress 11/18/26, 19:21

  11. Benni Mack commented on patch set 3 11/18/26, 19:22

    Reply Unresolved

    I think we should see if this happens further while we're improving e2e tests, but lets wait on it for the time being