Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debug: error message when debug run withoun launch.json #1113

Closed
aleksandr-shevchenko opened this issue Jan 22, 2021 · 9 comments
Closed

debug: error message when debug run withoun launch.json #1113

aleksandr-shevchenko opened this issue Jan 22, 2021 · 9 comments
Assignees
Labels
Debug Issues related to the debugging functionality of the extension. FrozenDueToAge
Milestone

Comments

@aleksandr-shevchenko
Copy link

a.go:
package main
import "fmt"
func main() {
fmt.Println(2 + 3)
}

  1. run "code a.go" or "code ." and open a.go
  2. press F5
  3. in 99% vscode write

API server listening at: 127.0.0.1:27232
5
Failed to get state - Process 11708 has exited with status 0
dumpStacktrace - Failed to get debugger state Process 11708 has exited with status 0
dumpStacktrace: Failed to produce stack traceProcess 11708 has exited with status 0
Process exiting with code: 0

  1. when create standard launch.json(launch file) and press F5, in 100% cases no any error messages

VSCode and golang latest version, but this behavior I see last half year.

My custom settings
"go.formatTool": "goimports",
"go.useLanguageServer": true,
"go.buildOnSave": "off",
"go.lintOnSave": "file",
"go.docsTool": "gogetdoc",

"[go]": {
"editor.detectIndentation": false,
"editor.tabSize": 4,
"editor.insertSpaces": true,
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
"editor.snippetSuggestions": "none"
},

"[go.mod]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
},

"gopls": {
"usePlaceholders": true
},

@suzmue suzmue changed the title error message when debug run withoun launch.json debug: error message when debug run withoun launch.json Jan 25, 2021
@suzmue suzmue added the Debug Issues related to the debugging functionality of the extension. label Jan 25, 2021
@suzmue
Copy link
Contributor

suzmue commented Jan 25, 2021

Thanks for filing an issue! It seems these two configurations happen to hit the timing of events differently. The terminated event is sent before the initial ThreadsRequest from vscode, causing an error when trying to get the debug state.

[19:53:35.408 UTC] To client: {"seq":0,"type":"event","event":"terminated"}
[19:53:35.408 UTC] TerminatedEvent
[19:53:35.440 UTC] From client: threads(undefined)
[19:53:35.441 UTC] [Error] Failed to get state - Process 31728 has exited with status 0
[19:53:35.441 UTC] ThreadsRequest
[19:53:35.441 UTC] [Error] dumpStacktrace - Failed to get debugger state Process 31728 has exited with status 0
[19:53:35.442 UTC] To client: {"seq":0,"type":"response","request_seq":4,"command":"threads","success":true,"body":{"threads":[]}}
[19:53:35.442 UTC] [Error] dumpStacktrace: Failed to produce stack traceProcess 31728 has exited with status 0

We can guard against requests sent after delve has exited to fix this.

@gopherbot
Copy link
Collaborator

Change https://golang.org/cl/286492 mentions this issue: src/goDebug: check if delve exited before attempting to get state

gopherbot pushed a commit that referenced this issue Jan 28, 2021
There is an initial ThreadsRequest after initialization from
vscode. If the program exits too quickly, this request may come
after delve has already exited. There is already a check to
ignore an error from ListGoRoutines if the debugState.exited.
This change adds the same check to threadsRequest before
isDebuggeeRunning is called, which tries to get the debugState
from delve.

Updates #1113

Change-Id: I01b1f2af9d7357c2363709b94435b797aa042459
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/286492
Trust: Suzy Mueller <[email protected]>
Run-TryBot: Suzy Mueller <[email protected]>
Reviewed-by: Polina Sokolova <[email protected]>
@hyangah hyangah added this to the v0.23.0 milestone Feb 16, 2021
@hyangah
Copy link
Contributor

hyangah commented Mar 2, 2021

@suzmue Is this fixed by cl/286492? Can we close this?

@aleksandr-shevchenko
Copy link
Author

No, not fixed.
ss_2021_03_02__10_24_56

@suzmue
Copy link
Contributor

suzmue commented Mar 2, 2021

@aleksandr-shevchenko The fix has not yet been released (it will be released in 0.23.0).

Could you try to install and use 'Go Nightly' to confirm that the error still appears? Thank you!

@aleksandr-shevchenko
Copy link
Author

Suzi, 'Go Nightly' works without error. Thank you very much.

@suzmue
Copy link
Contributor

suzmue commented Mar 2, 2021

@aleksandr-shevchenko Thanks for trying it out and letting us know! Will close this issue :)

@suzmue suzmue closed this as completed Mar 2, 2021
@IvanTurgenev
Copy link

I am getting this same error when I placed a breakpoint in an empty line, could not figure out why it was crashing

@suzmue
Copy link
Contributor

suzmue commented Aug 30, 2021

@IvanTurgenev could you please file a new issue with the debugging logs so we can look into what is happening? Instructions for capturing logs can be found here.

@golang golang locked and limited conversation to collaborators Aug 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Debug Issues related to the debugging functionality of the extension. FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

5 participants