Twig output buffering is incompatible with async rendering

Created on 12 September 2025, 6 days ago

Problem/Motivation

This bug took a lot of hours to track down - I found 2-3 unrelated bugs on the way and various dead end rabbit holes before realising what was happening.

Twig has traditionally used output buffering to render templates. This is incompatible with Fibers, because once the output buffer starts, other things can be outputted to it out of order.

This has actually been fixed in Twig already, see @fabpot's note in https://github.com/twigphp/Twig/issues/3599. However, Twig still uses output buffering by default, yield is only an option. So we need a two line change to core, then it should work.

I will post a fix-only MR here soon, this can then be integrated into 📌 Entity lazy multiple front loading Active and give us a green run there.

I tried to write a failing kernel test for this earlier in the week, but failed - however that was before I understood the root cause of the bug so maybe I can adapt that to expose the issue now. Will add that later.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

11.0 🔥

Component

render system

Created by

🇬🇧United Kingdom catch

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Merge request !13210Use yield. → (Open) created by catch
  • Pipeline finished with Failed
    6 days ago
    Total: 171s
    #596925
  • Pipeline finished with Failed
    5 days ago
    #597281
  • Pipeline finished with Failed
    5 days ago
    Total: 226s
    #597445
  • Merge request !13215Draft: Revert "Use yield." → (Open) created by catch
  • Pipeline finished with Failed
    5 days ago
    Total: 790s
    #597451
  • Pipeline finished with Failed
    5 days ago
    Total: 3700s
    #597448
  • Pipeline finished with Canceled
    5 days ago
    Total: 385s
    #597793
  • Pipeline finished with Failed
    5 days ago
    Total: 149s
    #597798
  • Pipeline finished with Failed
    5 days ago
    #597800
  • Merge request !13228Draft: POC for fixing menu attributes. → (Closed) created by godotislate
  • Pipeline finished with Success
    3 days ago
    Total: 799s
    #598347
  • Pipeline finished with Success
    3 days ago
    Total: 736s
    #598442
  • Pipeline finished with Failed
    3 days ago
    Total: 722s
    #598692
  • Pipeline finished with Success
    3 days ago
    Total: 737s
    #598709
  • Pipeline finished with Failed
    3 days ago
    Total: 179s
    #598719
  • Pipeline finished with Success
    3 days ago
    Total: 666s
    #598763
  • Pipeline finished with Failed
    3 days ago
    Total: 184s
    #598819
  • Pipeline finished with Success
    3 days ago
    Total: 853s
    #598844
  • Pipeline finished with Success
    1 day ago
    Total: 433s
    #600451
  • Pipeline finished with Failed
    1 day ago
    Total: 152s
    #600482
  • Pipeline finished with Success
    1 day ago
    Total: 832s
    #600532
Production build 0.71.5 2024