0

Since upgrading to PHP 8.1, Symfony 6.1, Monolog 3.2, I have been seeing a PHP fatal error while constructing the Symfony DI container:

2022/12/12 04:10:02 [error] 31#31: *919 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught TypeError: Monolog\Logger::getLevelName(): Argument #1 ($level) must be of type Monolog\Level|int, Symfony\Bridge\Monolog\Handler\ConsoleHandler given, called in /app/vendor/monolog/monolog/src/Monolog/Logger.php on line 196 and defined in /app/vendor/monolog/monolog/src/Monolog/Logger.php:437
Stack trace:
#0 /app/vendor/monolog/monolog/src/Monolog/Logger.php(196): Monolog\Logger::getLevelName()
#1 /app/var/cache/prod/ContainerOqglp2q/App_KernelProdContainer.php(1441): Monolog\Logger->pushHandler()
#2 /app/var/cache/prod/ContainerOqglp2q/App_KernelProdContainer.php(1103): ContainerOqglp2q\App_KernelProdContainer->getMonolog_Logger_RequestService()
#3 /app/vendor/symfony/dependency-injection/Container.php(218): ContainerOqglp2q\App_KernelProdContainer->getHttpKernelService()
#4 /app/vendor/symfony/dependency-injection/Container.php(198): Symfony\Component\DependencyInjection\Container->make()
#5 /app/vendor/symfony/http-kernel/Kernel.php(195): Symfony\Compone" while reading response header from upstream, client: 172.27.0.16, server: _, request: "POST /job-engine-client/execute HTTP/1.0", upstream: "fastcgi://192.168.64.5:9000", host: "x"

I have not been able to reproduce the error manually, as it only happens in my staging environment, and very inconsistent. It is currently only visible in HTTP requests triggered by a cronjob every 5 minutes. In the past 4 days, it only happened 2 times.

The application is deployed using docker compose, with a custom Ubuntu Dockerfile. The application is deployed to multiple hosts, and shows the same random occurence of errors on each host.

When looking at the Monolog Logger.php file, it is really hard to understand how the stack trace that is logged can be ever triggered.

I'm suspecting some kind of PHP opcache or JIT issue, or perhaps an issue with the docker filesystem returning some other cached (older) versions of files.

Has anyone seen similar errors, or perhaps other suggestions how to debug & resolve this issue?

Erik Baan
  • 436
  • 6
  • 12

0 Answers0