Description
Context:
- XAMPP on Windows
- PHP 8.0.3
Problem:
Monolog seems to eat up ressources (ThreadStackSize? ThreadsPerChild? MaxRequestsPerChild? - reasons unknown yet) which leads to a mysterious problem on Windows / WAMP. In my case it's XAMPP, but I guess it might also happen on other machines as they might use the same defaults.
Using Symfony with monolog (e.g. simply reproducable with https://github.com/symfony/demo) leads to these horrible errors:
Browser:
"The connection was reset" net::ERR_CONNECTION_RESET
errorlog:
[Fri Jul 02 06:42:45.297942 2021] [mpm_winnt:notice] [pid 5920:tid 684] AH00354: Child: Starting 150 worker threads.
[Fri Jul 02 06:42:57.561559 2021] [mpm_winnt:notice] [pid 4312:tid 652] AH00428: Parent: child process 5920 exited with status 3221225725 -- Restarting.
After two days and nights ( ;) ) I found out that it was monolog causing the problem. As I removed
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
and the monolog.yaml everything simply works on WAMP! Side loads, no errors!
My first thought was, that this might be caused by an infinite loop caused by an Error / exception but there's definitely no Error / Exception to be handled by Monolog and even it that had been the case, monolog should not fail and end up in such an inexpressive nightmare error like this.
We all know these kinds of errors where you have no clue where it may come from. This is one.
So from my perspective you can discuss if the related limits (see https://stackoverflow.com/a/43120319/10031165) are too low by default. But there's no reason to me, why monolog should eat up resources like this, especially if there isn't even an error.
Also see
- https://stackoverflow.com/a/43120319/10031165
- https://serverfault.com/questions/105908/how-do-you-increase-the-apache-connection-limit-wamp/105952
- https://stackoverflow.com/questions/5058845/how-do-i-increase-the-stack-size-for-apache-running-under-windows-7
monolog.yaml configuration was NOT changed, all default! I tried dev, test and prod - all failed!
Reproduction steps:
- Install XAMPP on Windows with PHP 8
- Install Symfony demo as documented on https://github.com/symfony/demo
- See the problem
- Lose days and nights to find out the reason :/
Possible reason:
Mad combination of:
- monolog eats up too many resources even if there is no error due to unknown reasons
- Too low (really?) defaults in httpd.conf for mpm_winnt_module on Windows (but changing that should be last resource I guess)?
- ???
Proposed solution:
- Workaround: Disable Monolog like I did described above until this is fixed
- Find out why monolog eats up resources (and which - ThreadStackSize? Child Processes?) and fix / limit it
- Increase limits like described in the links above