-
Notifications
You must be signed in to change notification settings - Fork 646
Generated debug launch config sets listening port to 2345 #1906
Comments
All three of I agree that they can be removed from the code snippet. PRs are welcome
|
Actually, looking at the code, it seems |
Looks like we do need a host and port for the client to connect. See https://github.com/Microsoft/vscode-go/blob/79e4f3824b89ec3151650fa14f3c59f71e6b2dd8/src/debugAdapter/goDebug.ts#L427 So, even if you made the change so that delve figures out a port to use by itself, we then need to parse its output to find the port and then pass it to the |
Yes, you are correct. I suggest we for now just set port to 0 in the autogenerated launch.json with the existing Anyway, let's see if delve can help (derekparker/delve#1332), because the current delve API makes it a bit difficult to use robustly without port clashes and securely. |
Agreed. I've removed The |
To try out the above changes, please see https://github.com/Microsoft/vscode-go/wiki/Use-the-beta-version-of-the-latest-Go-extension |
The fix for this is now out in the latest update to this extension (0.6.90) |
The debugging feature uses a
launch.json
file which sets parameters to use when running delve. The generated default includes"port": 2345
, which instructs delve to expose the API TCP server on port 2345. The delve default is to use port 0, which will cause the OS to select a free ephemeral port. One implication of using a static port 2345 is that it will not work if another service is listening on port 2345. It also makes derekparker/delve#1332 trivial to exploit, i.e., a malicious user or program on the same host can hijack the debugger.Recommendation: set
"port": 0
in the generatedlaunch.json
or leave the setting out altogether. For the use of VS Code I don't see why the user would want to set a fixed port when debugging locally.Steps to Reproduce:
API server listening at: 127.0.0.1:16234
. (16234 is picked by the OS)..vscode/launch.json
which has"port": 2345
.API server listening at: 127.0.0.1:2345
..vscode/launch.json
with port set to 2345 will also be generated through many other paths, e.g., if there is an error running or attaching to delve, then the user will be prompted to openlaunch.json
.The text was updated successfully, but these errors were encountered: