[warning] session_id(): Cannot change session id when headers already sent

Created on 8 March 2023, over 1 year ago

Here is a stack trace:

a:6:{s:5:"%type";s:7:"Warning";s:8:"@message";O:25:"Drupal\Core\Render\Markup":1:{s:9:"*string";s:64:"session_id(): Cannot change session id when headers already sent";}s:9:"%function";s:77:"Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy->setId()";s:5:"%file";s:113:"./htdocs/vendor/symfony/http-foundation/Session/Storage/Proxy/AbstractProxy.php";s:5:"%line";i:94;s:17:"@backtrace_string";s:4967:"#0 ./htdocs/core/includes/bootstrap.inc(346): _drupal_error_handler_real(2, 'session_id(): C...', '/data/var/www/v...', 94)
#1 [internal function]: _drupal_error_handler(2, 'session_id(): C...', '/data/var/www/v...', 94, Array)
#2 ./htdocs/vendor/symfony/http-foundation/Session/Storage/Proxy/AbstractProxy.php(94): session_id('apaFH--8_-6sjKp...')
#3 ./htdocs/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php(185): Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy->setId('apaFH--8_-6sjKp...')
#4 ./htdocs/core/lib/Drupal/Core/Session/SessionManager.php(141): Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->setId('apaFH--8_-6sjKp...')
#5 ./htdocs/vendor/symfony/http-foundation/Session/Session.php(199): Drupal\Core\Session\SessionManager->getId()
#6 ./htdocs/modules/contrib/nodejs/nodejs.module(539): Symfony\Component\HttpFoundation\Session\Session->getId()
#7 ./htdocs/modules/contrib/nodejs/nodejs.module(530): nodejs_auth_get_token_callback(Object(Symfony\Component\HttpFoundation\Session\Session))
#8 ./htdocs/modules/contrib/nodejs/nodejs.module(308): nodejs_auth_get_token(Object(Symfony\Component\HttpFoundation\Session\Session))
#9 ./htdocs/core/lib/Drupal/Core/Extension/ModuleHandler.php(539): nodejs_js_settings_alter(Array, Object(Drupal\Core\Asset\AttachedAssets), NULL)
#10 ./htdocs/core/lib/Drupal/Core/Asset/AssetResolver.php(329): Drupal\Core\Extension\ModuleHandler->alter('js_settings', Array, Object(Drupal\Core\Asset\AttachedAssets))
#11 ./htdocs/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php(319): Drupal\Core\Asset\AssetResolver->getJsAssets(Object(Drupal\Core\Asset\AttachedAssets), true)
#12 ./htdocs/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php(158): Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAssetLibraries(Object(Drupal\Core\Asset\AttachedAssets), Array)
#13 ./htdocs/core/modules/big_pipe/src/Render/BigPipeResponseAttachmentsProcessor.php(94): Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAttachments(Object(Drupal\Core\Render\HtmlResponse))
#14 ./htdocs/core/lib/Drupal/Core/EventSubscriber/HtmlResponseSubscriber.php(45): Drupal\big_pipe\Render\BigPipeResponseAttachmentsProcessor->processAttachments(Object(Drupal\Core\Render\HtmlResponse))
#15 [internal function]: Drupal\Core\EventSubscriber\HtmlResponseSubscriber->onRespond(Object(Symfony\Component\HttpKernel\Event\ResponseEvent), 'kernel.response', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#16 ./htdocs/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\ResponseEvent), 'kernel.response', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#17 ./htdocs/core/modules/big_pipe/src/Render/BigPipe.php(652): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object(Symfony\Component\HttpKernel\Event\ResponseEvent), 'kernel.response')
#18 ./htdocs/core/modules/big_pipe/src/Render/BigPipe.php(630): Drupal\big_pipe\Render\BigPipe->filterResponse(Object(Symfony\Component\HttpFoundation\Request), 2, Object(Drupal\Core\Render\HtmlResponse))
#19 ./htdocs/core/modules/big_pipe/src/Render/BigPipe.php(470): Drupal\big_pipe\Render\BigPipe->filterEmbeddedResponse(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Render\HtmlResponse))
#20 ./htdocs/core/modules/big_pipe/src/Render/BigPipe.php(336): Drupal\big_pipe\Render\BigPipe->sendNoJsPlaceholders('\n #21 ./htdocs/core/modules/big_pipe/src/Render/BigPipe.php(304): Drupal\big_pipe\Render\BigPipe->sendPreBody('\n #22 ./htdocs/core/modules/big_pipe/src/Render/BigPipeResponse.php(112): Drupal\big_pipe\Render\BigPipe->sendContent(Object(Drupal\big_pipe\Render\BigPipeResponse))
#23 ./htdocs/vendor/symfony/http-foundation/Response.php(381): Drupal\big_pipe\Render\BigPipeResponse->sendContent()
#24 ./htdocs/index.php(20): Symfony\Component\HttpFoundation\Response->send()
#25 {main}";}

Using:
Drupal version : 9.3.22
Site URI : http://default
DB driver : MySQL
Drush version : 10.6.2

Third-Party Module:
Node.js integration
https://www.drupal.org/project/nodejs

🐛 Bug report
Status

Active

Version

1.3

Component

Code

Created by

🇮🇳India sirsendu

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

Comments & Activities

  • Issue created by @sirsendu
  • Status changed to Postponed: needs info over 1 year ago
  • Thanks for the stack grace. It looks like this is something to do with the nodejs module. In terms of getting this issue sorted into the correct queue: What are the steps to reproduce, beginning with "Install Drupal 9"?

    Drupal 9.3 is no longer supported.

  • 🇮🇳India sirsendu

    Thanks cilefen for the quick reply.

    From the site's 'login' page, this warning is thrown and can be observed in the watchdog table also.

    The following is the code block (found in nodejs.module) from where the warning is thrown.
    /**
    * Default nodejs_auth_get_token() implementation.
    */
    function nodejs_auth_get_token_callback(SessionInterface $session) {
    // The session id stored in the database is hashed. Use the same to generate
    // the token.
    return md5(Crypt::hashBase64($session->getId()));
    }

  • Status changed to Active over 1 year ago
Production build 0.71.5 2024