英文:
How can I fix the vscode debuger in VSCode?
问题
我正在尝试使用dvl-dap在VSCode中调试一段简单的Golang代码,但是我遇到了以下错误:
有人知道如何解决这个问题吗?
我是通过Remote - SSH扩展从远程虚拟机上工作的。
英文:
I'm trying to debug a simple Golang code in VSCode with dvl-dap and I get the following error:
Does anybody know how can I solved this issue?
I'm working from a remote vm using the extension Remote - SSH.
答案1
得分: 5
我正在为你翻译以下内容:
我正在添加这个作为参考,以防其他人遇到这个问题。
修复已经合并/发布在v1.7.1上,但我正在远程调试v1.8.3,仍然遇到这个问题。
一个可能的解决方法是在你的VSCode的settings.json中禁用“同一用户”检查,像这样:
go.delveConfig": {
"debugAdapter": "dlv-dap",
"dlvFlags": ["--only-same-user=false"],
[...]
}
然后让VSCode使用默认的launch.json来远程运行delve并连接到你的本地客户端--在我测试过的项目中,我甚至没有定义一个自定义的launch.json。
英文:
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.
答案2
得分: 0
这最初是在golang/vscode-go
问题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"}
主要错误信息为:
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
它在delve的一个分支中修复了:suzmue/delve
提交5137515,但该补丁可能尚未集成到go-delve/delve中:其CHANGELOG尚未列出"service: fix sameuser check"。
不过,请确保您正在使用最新的delve 1.7.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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论