microsoft / vscode-go

An extension for VS Code which provides support for the Go language. We have moved to https://github.com/golang/vscode-go
Other
5.93k stars 648 forks source link

Debugger fails to connect to remote headless multi-client session #3206

Closed firelizzard18 closed 4 years ago

firelizzard18 commented 4 years ago

What version of Go, VS Code & VS Code Go extension are you using?

Share the Go related settings you have added/edited

{
    "go.lintOnSave": "off",
    "go.formatTool": "goimports",
    "go.useLanguageServer": true,
}

Describe the bug

When I run dlv debug --headless --accept-multiclient --continue, attempting to connect to it remotely does not work. I expect it to work.

Steps to reproduce the behavior:

It does seem like VSCode is doing something. If I connect on the CLI, then disconnect without continuing (leaving the debugger halted), when I connect with VSCode, the debugger continues. VSCode thinks its in a debug session, but variables/watch/call stack show nothing and using VSCode to pause the process has no effect.

Configuration

{
    "name": "REDACTED",
    "type": "go",
    "request": "attach",
    "mode": "remote",
    "remotePath": "${workspaceFolder}/REDACTED",
    "port": 8181,
    "host": "REDACTED",
    "trace": "verbose"
}

Logs

2020-4-24, 21:22:05.987 UTC
From client: initialize({"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"go","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us","supportsProgressReporting":true})
InitializeRequest
To client: {"seq":0,"type":"response","request_seq":1,"command":"initialize","success":true,"body":{"supportsConfigurationDoneRequest":true,"supportsSetVariable":true}}
InitializeResponse
From client: attach({"name":"REDACTED","type":"go","request":"attach","mode":"remote","remotePath":"REDACTED","port":8181,"host":"REDACTED","trace":"verbose","packagePathToGoModPathMap":{"REDACTED":"REDACTED","REDACTED\\.vscode":"REDACTED","REDACTED\\REDACTED":"REDACTED",".":""},"env":{"GOPATH":"C:\\Users\\ME\\go","ALLUSERSPROFILE":"C:\\ProgramData","AMD_ENTRYPOINT":"vs/workbench/services/extensions/node/extensionHostProcess","APPDATA":"C:\\Users\\ME\\AppData\\Roaming","APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL":"true","ChocolateyInstall":"C:\\ProgramData\\chocolatey","ChocolateyLastPathUpdate":"132258403956604533","CommonProgramFiles":"C:\\Program Files\\Common Files","CommonProgramFiles(x86)":"C:\\Program Files (x86)\\Common Files","CommonProgramW6432":"C:\\Program Files\\Common Files","COMPUTERNAME":"REDACTED","ComSpec":"C:\\WINDOWS\\system32\\cmd.exe","DriverData":"C:\\Windows\\System32\\Drivers\\DriverData","ELECTRON_RUN_AS_NODE":"1","FPS_BROWSER_APP_PROFILE_STRING":"Internet Explorer","FPS_BROWSER_USER_PROFILE_STRING":"Default","GOPROXY":"https://proxy.golang.org,direct","GOROOT":"c:\\go","HOMEDRIVE":"C:","HOMEPATH":"\\Users\\ME","LOCALAPPDATA":"C:\\Users\\ME\\AppData\\Local"[...]
To client: {"seq":0,"type":"event","event":"initialized"}
InitializeEvent
To client: {"seq":0,"type":"response","request_seq":2,"command":"attach","success":true}
From client: configurationDone(undefined)
ConfigurationDoneRequest
From client: disconnect({"restart":false})
DisconnectRequest
HaltRequest
hyangah commented 4 years ago

@polinasok @quoctruong I am not familiar with DAP client's expectation when during initialization - based on the log, it seems DAP client was unhappy about something after ConfigurationDoneRequest is done. Can you please take a look? (Note the use of --accept-multiclient --continue. This is reproducible.)

bulentkazanci commented 4 years ago

@firelizzard18 Are you running the application on your local? If so, set the "remotePath": "${workspaceFolder}" and make sure that you set breakpoints on vscode before running debug on vscode. It looks like on the debug log you provided that no breakpoint was provided.

firelizzard18 commented 4 years ago

@bulentkazanci I was not running locally, hence "host": "REDACTED". I'm fairly certain I had breakpoints set in the code.

quoctruong commented 4 years ago

Please give the nightly build a try: https://github.com/golang/vscode-go/blob/master/docs/nightly.md. We now automatically try to infer the path so you don't have to supply remotePath at all.

stamblerre commented 4 years ago

Please follow the discussion on golang#45 or file a new issue if this still isn't working for you.