Review main Merged

66707[BUGFIX] Release locks in middleware to prevent locking deadlock

Christian Kuhn CR +2 V +2 Easy +14 −0 updated 11/20/20, 10:04

Commit message

In the frontend middleware chain PrepareTypoScriptFrontendRendering
interacts with TSFE and calls getFromCache() which acquires frontend
rendering locks. Locks are usually released after TSFE rendering in
the final middleware, the HTTP/RequestHandler.

Middleware ShortcutAndMountPointRedirect however, wich is called
after PrepareTypoScriptFrontendRendering, can return early without
calling below middlewares. In this case, locks need to be explicitly
released to prevent a deadlock.

This is not an issue in normal frontend calls since acquired locks
are always released in __destruct() of the locking API.

But, if the frontend is called as sub request, for instance from
within another frontend call, from cli or testing, the lock API
destructors may or may not be called. If not, this leads to dangling
locks after the FE sub request, which then may block a following sub
request executed in the same process.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Markus Klein +1
    • Benni Mack +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Markus Klein +1
    • Benni Mack +1
    • TYPO3com +1 CI

Issues 1

Files 1

Review log 1113

  1. Christian Kuhn uploaded patch set 1 11/19/20, 16:34

  2. Benni Mack voted on patch set 1 CR +1 11/19/20, 16:37

  3. TYPO3com voted on patch set 1 V +1 11/19/20, 16:46 Completed build in 11m 30s on Thu, 19 Nov, 04:46 PM Test Summary: 73719 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7427

  4. Benni Mack voted on patch set 1 V +1 11/19/20, 22:51

  5. Markus Klein commented on patch set 1 11/20/20, 08:01

    IMO we could also backport this to v10
  6. Benni Mack commented on patch set 1 11/20/20, 09:37

    Fine with me too
  7. Christian Kuhn commented on patch set 1 11/20/20, 09:38

    I was not 100% sure about v10. I debugged now: The middleware call chain is identical in v10 for the classes in question. So v10 is affected. A backport will conflict, but that can be solved easily. The patch should be safe in v10.
  8. Christian Kuhn updated the commit message in patch set 2 11/20/20, 09:38

  9. Benni Mack voted on patch set 2 V +1 CR +1 11/20/20, 09:44

  10. TYPO3com voted on patch set 2 V +1 11/20/20, 09:54 Completed build in 15m 17s on Fri, 20 Nov, 09:53 AM Test Summary: 73719 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7436

  11. Markus Klein voted on patch set 2 V +1 CR +1 11/20/20, 10:04

  12. Christian Kuhn voted on patch set 2 V +2 CR +2 11/20/20, 10:04

  13. Christian Kuhn merged patch set 3 11/20/20, 10:04