Hello,
I am working on a shared Debian server via VS Code Remote SSH. I have DBGpProxy running, and everything works almost perfectly.
Here is my launch.json configuration:
{
"configurations": [
{
"name": "Debug",
"type": "php",
"request": "launch",
"port": 9004,
"dbgpProxy": {
"enable": true,
"host": "127.0.0.1",
"port": 9001
}
}
]
}
The problem is that the configurations.port property is required. When I start debugging, I see the following output:
Listening to Xdebug on port 0.0.0.0:9004 ...
Registering with the DBGp proxy on "127.0.0.1:9001" with key "user" ...
Registration successful.
However, when a second developer tries to start another session, they get an error like this:
Listening to Xdebug on 0.0.0.0:9004 failed: Error: listen EADDRINUSE: address already in use 0.0.0.0:9004
This is expected, since I am already listening on that port. But in this case, we shouldn't need to listen at all, because we are using a DBGp proxy.
Currently, the other developer has to change the port manually (guessing any available one) just to start their session.
I see two possible ways to improve this:
Do not start the listening thread at all if a proxy is defined. When dbgpProxy.enable is true, starting the local listener is sensless.
Support an array of ports (e.g., [9004, 9005, 9006]). This seems to be partially supported already, but if the first port is taken, the debug session fails. Instead, it should try the next available port in the array automatically.