# content
Fail Faster
Original Post

For a long time I have heard complaints that Xdebug, with its debugger enabled, slows down applications, even if there is no IDE listening.

I have never been able to reproduce this, as on Linux (and macOS), TCP connections to a localhost ports fail immediately if that port is not open.

Xdebug waits for up to 200ms when making a debug connection. This is configurable with the xdebug.connect_timeout_ms setting.

But if there is nothing listening, there should not be any delay, as it ought to be an immediate error.

I wrote a comment in an issue from 2024:

It turns out, that it is not a firewall, but that Windows itself behaves bad here. Instead of failing immediately, it retry sending TCP SYN packets to try to establish a connection. This is pointless on the local loopback interface, as network packets cannot get lost.

Through a post by Daniel Stenberg on Mastodon, I found out the cause, and a solution.

He explains how it affects curl's Happy Eyeballs algorithm in a blog post from 2024. Although Xdebug does not use Happy Eyeballs, the underlying problem is the same.

Last week, Marcel Jamin wrote to the curl mailing list, with a solution. This solution disables the retry mechanism to establish a connection. And in turn that means, that there is no longer a delay on Windows either.

I have today merged a pull request for Xdebug which implements this solution. The patch is part of the upcoming Xdebug 3.6 release.