View Issue Details
|0002198: Slowness due to report errors ignored by error_reporting
I am working on migrating an old codebase that partly worked on PHP 5.6 to PHP 8.2. You can imagine how many errors and warnings this application gives, so the strategy I am following is focusing on solving errors and then continue with all the warnings and notices to reduce it to the minimum. This strategy is working, but I am facing a problem that when debugging and a debugger is connected the requests are being processed very slowly compared without a debugger connected. Frpm 0.1s to 6-8s per request.
I have inspected the logs with log level 7 (I have tried log level 10, but generates gigabyte size log file) and I see more than 10000 lines of messages of warning, deprecated and notice sent to the debugger client. The error_reporting configuration I have setup is this:
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE & ~E_WARNING
This way I hide warning, notice and deprecated messages, but it seems Xdebug is ignoring it internally and reporting it to the debugger client, which makes it very slow due to the high number of warnings and notices of the codebase. I also have xdebug.start_with_request=yes, which makes it slower to debug, because all requests are being processed by Xdebug.
I attach a log with redacted information.
Thank you and sorry to bother you if this is how the debugger works.
xdebug.log = /data/xdebug.log
|No tags attached.
xdebug.log (394,315 bytes)
|Docker Debian Linux
For the notifications, this is something that IDEs need to opt into. In your log, there is:
Which does exactly that. I've had a quick stroll through the rest of your log, and I understand exactly why this is causing a slow-down. There are indeed more than a 1000 in just that single file.
Unlike some other features, it doesn't seem PhpStorm (nor VS Code) lets you configure this.
So, I see a few options to address this, in no particular order
I don't really know which one is best. I lean towards 3.
Furthermore, I would suggest to make sure you only enable the breakpoints that you need for this project, as there is overhead for each of them as they need to be checked after each statement. You don't have to remove them, but just disable them.
I have tried option 3 with this value, but it still takes the same time:
xdebug.force_error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE & ~E_WARNING
About option 1, if it will stop breakpoint resolve I don't think it would be analyzed, but I will try to contact Jetbrains which is the IDE we use.
And option 4 I haven't found which option is to use it.
For the breakpoint, yes you are sure. Every often I clean them when there are a lot. I have cleared them and got the same result. I also tested it on VS Code before posting the issue with a clean installation of it to discard any phpstorm configuration and got the same results.