Fix Failed to start the session because headers have already been sent by http-foundation response

Created on 5 June 2024, 5 months ago

Problem/Motivation

Noticed a warning and php logged error on the first hit only

Steps to reproduce

When visiting a page for the first time
Then the image is taking 1s more to load
And no error and warning in the browser error log
But at the back-end system logs noticed to logged items

Message	RuntimeException: Failed to start the session because headers have already been sent by "/app/vendor/symfony/http-foundation/Response.php" at line 408. in Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start() (line 132 of /app/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php)
#0 /app/docroot/core/lib/Drupal/Core/Session/SessionManager.php(144): Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start()
#1 /app/docroot/core/lib/Drupal/Core/Session/SessionManager.php(109): Drupal\Core\Session\SessionManager->startNow()
#2 /app/vendor/symfony/http-foundation/Session/Session.php(59): Drupal\Core\Session\SessionManager->start()
#3 /app/docroot/core/modules/big_pipe/src/Render/BigPipe.php(240): Symfony\Component\HttpFoundation\Session\Session->start()
#4 /app/docroot/core/modules/big_pipe/src/Render/BigPipe.php(295): Drupal\big_pipe\Render\BigPipe->performPreSendTasks()
#5 /app/docroot/core/modules/big_pipe/src/Render/BigPipeResponse.php(112): Drupal\big_pipe\Render\BigPipe->sendContent(Object(Drupal\big_pipe\Render\BigPipeResponse))
#6 /app/vendor/symfony/http-foundation/Response.php(423): Drupal\big_pipe\Render\BigPipeResponse->sendContent()
#7 /app/docroot/index.php(20): Symfony\Component\HttpFoundation\Response->send()
#8 {main}

Proposed resolution

N/A

Remaining tasks

  • File an issue
  • MR
  • Test
  • Review

User interface changes

API changes

Data model changes

📌 Task
Status

Active

Version

1.0

Component

Code

Created by

🇯🇴Jordan Rajab Natshah Jordan

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

Comments & Activities

Production build 0.71.5 2024