Failed to start the session because headers..

Created on 19 February 2024, 4 months ago
Updated 27 June 2024, about 21 hours ago

I'm not 100% sure how to replicate this issue but we are seeing the following PHP error in our log files:

RuntimeException: Failed to start the session because headers have already been sent by "/var/www/mysite.com/vendor/symfony/http-foundation/Response.php" at line 1325. in Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start() (line 132 of /var/www/mysite.com/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php)

The referrer is: https://www.mysite.com/o365/login?destination

Looking through the log I don't see any successful logins before of after the PHP error.

Thanks.

πŸ› Bug report
Status

Active

Version

5.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom sittard

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

Comments & Activities

  • Issue created by @sittard
  • πŸ‡³πŸ‡±Netherlands batigolix Utrecht
  • πŸ‡³πŸ‡±Netherlands robertragas

    Also having the same issue when upgrading from 3.x to 5.0.7

  • πŸ‡³πŸ‡±Netherlands robertragas

    I have been able to consistently reproduce it by having a destination parameter in the url, once you press on the login with o365 button you will already get it before even returning from the azure login.

    If you would remove that the error is not present.

  • πŸ‡¨πŸ‡΄Colombia Freddy Rodriguez BogotΓ‘

    I'm encountering the same issue where some requests are being redirected to "/o365/login?destination=":

    The normal link in the main menu, "https://foo/example," is being redirected to "https://foo/o365/login?destination=example." As a result, the browser is triggering the ERR_TOO_MANY_REDIRECTS error for the users.

  • πŸ‡¨πŸ‡΄Colombia Freddy Rodriguez BogotΓ‘

    This case is really ambiguous. At this point, I'm not 100% sure if the problem described in the last comment was caused by the o365 module.

    Here's what I did to track the problem:

    1. Uninstalled the o365 sub-modules.
    2. Uninstalled the o365 main module.

    However, the error persisted.

    3. Uninstalled all the contrib modules.

    The error still persisted with just the core module. :(

    4. Restarted all the app containers.

    After this, the issue was no longer present.

    5. Restored a backup of the database with all modules, including the o365 modules.

    The problem is not present any more.

    Given these findings, I have some theories to share:

    1. The issue might have been caused by an error during login, creating a "mid part login" state where some components had an active cached session while others did not. This could explain why some links were redirecting to the ?destination URL parameter.

    2. Could there be a session cache at the backend level affecting default routing after logout? Perhaps the "mid part login" occurred during logout and persisted through subsequent logins.

    3. Other cache layers such as WPA, Varnish, or Big Pipe might also be involved.

  • πŸ‡³πŸ‡±Netherlands robertragas

    In my situation Big Pipe is involved indeed.

Production build 0.69.0 2024