-
Notifications
You must be signed in to change notification settings - Fork 753
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: unable to produce stack trace: "unknown goroutine 1" #179
Comments
This is more or less working as intended. There are no goroutines on program entry that delve can report on. But vscode requires that at least 1 thread (and in our case goroutine) is returned. Returning none doesn't work and is against the spec. I discovered this from experience when implementing the DAP version - see our discussion here: go-delve/delve#1914 (comment) and the original discussion here: microsoft/vscode-go#2126 (comment). And if you return a goroutine that doesn't exist, you will understandably get back a stack trace error. What might make sense is the following: |
Just for comparison, if you use delve front-end with "dlv debug" or similar subcommand, on entry you will also get no goroutine information and no usable stack as well:
|
Thanks for the investigation. @polinasok This popup appears and there is no stack trace even though there should be. |
Your pictorial example is for "stop on entry". Could you please be more specific as to where exactly you want me to set a breakpoint to reproduce what you are referring to? I do agree that a pop-up is unnecessary here. Hence see my earlier suggestion (1). |
You are not paused at a breakpoint here. The red dot is not highlighted. You are paused on entry before the program and any goroutines started running. The CALL STACK says "paused on entry", not "paused on breakpoint". If you click continue and pause on breakpoint, you should not see this pop-up anymore and the CALL STACK should show you something useful. |
You should have a setting in launch.json configuration "stopOnEntry": true. Set it to false and you will skip this situation all-together. |
Ah I see. TBH I don't know how 'stopOnEntry' got there :-) and I didn't get any stack trace after clicking continue. After upgrading to VS Code, it started to appear. Thanks for the explanation. I think suppressing the popup is sufficient. I think it's better if we can display something that makes sense more than "unknown goroutine 1" (e.g."no goroutine") but we can live with that. |
I have been working out some complicated logic to special handle the dummy goroutine case, but then it occurred to me: is there any advantage in having a pop-up for the stacktrace errors? The stack traces are not explicitly requested by the user, but are a side effect of other events and already show up on the side under CALL STACK anyway, right? So perhaps it makes sense to suppress the pop-ups for all of "Unable to produce stack trace" situations? |
@polinasok Thanks for the investigation. Let's suppress the pop-up - the necessary information is already under CALL STACK as you pointed out. |
In dlv-dap, |
Change https://golang.org/cl/293530 mentions this issue: |
The errors already show up in the UI under CALL STACK, so the pop-ups just get in the way. Updates #179 Change-Id: I3ba1e7c65c363e00d16b0962a83b0f873bfd0e60 GitHub-Last-Rev: b3a2611 GitHub-Pull-Request: #1236 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/293530 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com> Trust: Hyang-Ah Hana Kim <hyangah@gmail.com> Trust: Polina Sokolova <polina@google.com> Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
VSCode insiders: 1.46.0-insider
Go Nightly: 2020.6.322
darwin/amd64
go: 1.14.3
delve: 1.4.1
Start debugging (F5) the following program.
with launch.json
attached: debug log
When delve returns no goroutine, the debug adapter inserts a "Dummy" goroutine with id 1. VS Code subsequently issues StackTraceRequest for ID 1, and that results in "unknown goroutine 1" error.
@polinasok
The text was updated successfully, but these errors were encountered: