'How can I fix the vscode debuger in VSCode?
Solution 1:[1]
I'm adding this for reference in case someone else faces this issue.
The fix was merged/released on v1.7.1, but I'm remote debugging on v1.8.3 and still hitting that problem.
One possible workaround is to disable the 'same user' check in your VSCode settings.json, like this
go.delveConfig": {
"debugAdapter": "dlv-dap",
"dlvFlags": ["--only-same-user=false"],
[...]
}
and then just let VSCode use a default launch.json to run delve remotely and attach your local client -- in the project where I've tested this, I haven't even defined a custom launch.json.
Solution 2:[2]
That was reported initially in golang/vscode-go
issue 1555:
>> accepted connection from client
-> server: {"type":"request","seq":1,"command":"initialize","arguments":{"adapterID":"go","linesStartAt1":true,"columnsStartAt1":true,"pathFormat":"path"}}
<- server: {"seq":0,"type":"event","event":"output","body":{"category":"console","output":"DAP server listening at: 127.0.0.1:40535\n2021-06-09T02:26:51Z debug layer=dap DAP server pid = 12574\n"}}
<- server: {"seq":0,"type":"event","event":"output","body":{"category":"stderr","output":"2021/06/09 02:26:51 sameuser_linux.go:114: closing connection from different user (127.0.0.1:52544): connections to localhost are only accepted from the same UNIX user for security reasons\n"}}
<- server: {"seq":0,"type":"event","event":"output","body":{"category":"console","output":"2021-06-09T02:26:51Z error layer=dap Error accepting client connection: Only connections from the same user that started this instance of Delve are allowed to connect. See --only-same-user.\n2021-06-09T02:26:51Z debug layer=dap DAP server stopping...\n2021-06-09T02:26:51Z debug layer=dap DAP server stopped\n"}}
<- server: {"seq":0,"type":"event","event":"output","body":{"category":"console","output":"connection error: Error: read ECONNRESET\n"}}
<- server: {"seq":0,"type":"event","event":"terminated"}
With the main error message being:
sameuser_linux.go:114: closing connection from different user (127.0.0.1:52544):
connections to localhost are only accepted from the same UNIX user for security reasons
It is fixed in a fork of delve: suzmue/delve
commit 5137515, but said patch might not have been yet integrated to go-delve/delve: its CHANGELOG does not yet list "service: fix sameuser check".
Still, make sure you are using the latest delve 1.7.2.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Marcos |
Solution 2 | VonC |