Icinga/icingaweb2

Session Exception on Notification Endpoint since IcingaWeb2 2.12.1

jan-kantert opened this issue · 7 comments

Describe the bug

When opening https://example.com/icingadb/notifications?history.event_time%20%3E%2030%20minutes%20ago&format=json we get this error:

[some_events<br />

<b>Fatal error</b>:  Uncaught ErrorException: Uncaught ErrorException: session_name(): Cannot change session name when headers already sent in /usr/share/icingaweb2/library/Icinga/Web/Session/Php72Session.php:20
Stack trace:
#0 [internal function]: Icinga\Application\ApplicationBootstrap-&gt;Icinga\Application\{closure}()
#1 /usr/share/icingaweb2/library/Icinga/Web/Session/Php72Session.php(20): session_name()
#2 /usr/share/icingaweb2/library/Icinga/Web/Session/PhpSession.php(167): Icinga\Web\Session\Php72Session-&gt;open()
#3 /usr/share/icingaweb2/library/Icinga/Web/Controller/ActionController.php(579): Icinga\Web\Session\PhpSession-&gt;write()
#4 /usr/share/icingaweb2/library/Icinga/Web/Controller/ActionController.php(525): Icinga\Web\Controller\ActionController-&gt;shutdownSession()
#5 /usr/share/icingaweb2/modules/icingadb/application/controllers/ErrorController.php(58): Icinga\Web\Controller\ActionController-&gt;postDispatch()
#6 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Action.php(521): Icinga\Module\Ici in <b>/usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Plugin/Broker.php</b> on line <b>262</b><br />

As we use this in our monitoring clients it breaks the client for us.

To Reproduce

Provide a link to a live example, or an unambiguous set of steps to reproduce this issue. Include configuration, logs, etc. to reproduce, if relevant.

  1. Open https://example.com/icingadb/notifications?history.event_time%20%3E%2030%20minutes%20ago&format=json

Expected behavior

Notifications should be returned correctly. This worked in 2.12.0.

Screenshots

See above.

Your Environment

Include as many relevant details about the environment you experienced the problem in

  • Icinga Web 2 version and modules (System - About): 2.12.1
    Git Commit cd2daeb
    Git Commit Datum 2023-11-15
  • Web browser used: Firefox, Chrome, Edge, curl, wget, requests
  • Icinga 2 version used (icinga2 --version): 2.13.8 (since 2.14.0 breaks sync for us)
  • PHP version used (php --version): 7.4.33
  • Server operating system and version: Debian/Official Docker Image

Hey,

please have a look at the php error log. There may be a clue (another stacktrace) why this is happening.

please have a look at the php error log. There may be a clue (another stacktrace) why this is happening.

php error log = apache error log? I guess the docker container pipes everything to standard out, correct? If that is the case then there has not been any log entries during that time according to our logging server.

We could upgrade again but I would need some clarification on where to look in the official docker.

php error log = apache error log?

Yes. Though, it's stderr were it's piped to. And if you let Icinga Web also log there (by using -e icingaweb.config.logging.log=php) it will also contain Icinga Web's log.

Hey, did you find more in the logs?

I see this error in our log:

[Wed Jan 17 09:58:11.190265 2024] [php7:error] [pid 91] [client 172.20.108.110:59222] PHP Fatal error:  Uncaught ErrorException: Uncaught ErrorException: session_name(): Cannot change session name when headers already sent in /usr/share/icingaweb2/library/Icinga/Web/Session/Php72Session.php:20\nStack trace:\n#0 [internal function]: Icinga\\Application\\ApplicationBootstrap->Icinga\\Application\\{closure}()\n#1 /usr/share/icingaweb2/library/Icinga/Web/Session/Php72Session.php(20): session_name()\n#2 /usr/share/icingaweb2/library/Icinga/Web/Session/PhpSession.php(167): Icinga\\Web\\Session\\Php72Session->open()\n#3 /usr/share/icingaweb2/library/Icinga/Web/Controller/ActionController.php(579): Icinga\\Web\\Session\\PhpSession->write()\n#4 /usr/share/icingaweb2/library/Icinga/Web/Controller/ActionController.php(525): Icinga\\Web\\Controller\\ActionController->shutdownSession()\n#5 /usr/share/icingaweb2/modules/icingadb/application/controllers/ErrorController.php(58): Icinga\\Web\\Controller\\ActionController->postDispatch()\n#6 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Action.php(521): Icinga\\Module\\Ici in /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Plugin/Broker.php on line 262, referer: https://icinga.xxxx

Maybe that helps?

Oooh, sorry, I didn't try it for myself until now and thus didn't notice that it belongs to Icinga DB Web where a similar issue has been opened last week. 🤦‍♂️