Xdebug initiates connections with the client on no error

141 Views Asked by At

I'm experiencing an issue I'm not sure is an issue or intended.

xdebug.mode=debug
xdebug.start_upon_error=yes

There is no (uncaught) error or exception in the script, but the connection is initiated serveral times during the request handling. This causes extremly slow responses, especially when the client is not listening, this appears in the console several times (4-6).

[Fri Apr 23 15:32:31 2021] Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port) :-(

All exceptions are handled correctly, the response is OK, it's just terribly slow.

If I turn start_upon_error to no or the mode to develop, this problem vanishes.

The documentation does not state anything on this topic, while for both xdebug.show_error_trace and xdebug.show_exception_trace there is info, as follows:

When this setting is set to 1, Xdebug will show a stack trace whenever an Error is raised - even if this Error is actually caught.

So my question is, is this behaviour intended? If so, it should appear in the documentation too.

Tried this with Xdebug versions 3.0.0 and 3.0.4 (PHP 8, ZTS, x64). Thanks for reactions in advance.

1

There are 1 best solutions below

1
On BEST ANSWER

When an exception gets through, Xdebug does not know (and can not see) whether it is going to be caught. Because of that, it needs to initiate a debugging request so an IDE can handle the potential warning/error/Exception.

This is therefore intended.

As you say, it should be documented. The best way to get that sorted, is to file a feature/doc bug request at https://bugs.xdebug.org