-
Notifications
You must be signed in to change notification settings - Fork 765
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: supports disconnect/restart while program is running #1347
Comments
This happens only when the debugged program is "RUNNING". If we set a breakpoint, the restart triggers a 'disconnect' command first to the debug adapter before restarting. Another issue is that, after sending the The first step is to fix the delve to accept more requests. cc/ @suzmue @polinasok |
That's right: disconnecting while running is blocked on async support that is work in progress. It is odd that vscode doesn't wait for disconnect response before calling the factory code again to relaunch. According to the DAP spec, a client should "implement 'restart' by terminating and relaunching the adapter", which to me implies actually waiting for the indication that the adapter terminated (aka disconnect response). If that is not the case, I would file a bug against vscode. In any case, when the factory starts up a new server, I think it should always use a new port. Even if our code times everything right, we are still at the mercy of the OS. The port might take a moment to free up. This actually reminds me of microsoft/debug-adapter-protocol#126. Does vscode set |
Thanks @polinasok
Unsurprisingly, there is a timeout. Since dlv dap didn't respond timely, VS Code went ahead, continued remaining cleanup tasks (socket close, adapter dispose, ...), and restarted.
I think the timeout from the client side is a reasonable defense mechanism in this case.
Yes, I will prepare a fix.
Yes. |
Change https://golang.org/cl/305552 mentions this issue: |
This is a change to avoid modifying vscode.DebugConfiguration's port attribute inside startDapServer function. VSCode invokes DebugAdapterDescriptorFactory's createDebugAdapterDescriptor with the same DebugSession & DebugConfiguration objects when the session restart is requested. If we mess with the port attribute, the next call will be handled as if it was requested to connect to an external DAP server. So, let's stop modifying it. Updates #1347 Change-Id: I82d7b7f48924fd36e7a881be39fedf2e440e4809 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/305552 Trust: Hyang-Ah Hana Kim <hyangah@gmail.com> Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Suzy Mueller <suzmue@golang.org>
Both disconnect and restart for me now. |
Thanks @polinasok. |
How to reproduce:
simple program
Launch debugging (F5) with
"debugAdapter": "dlv-dap"
in launch.jsonWhile the program is sleeping, restart debugging (⇧⌘F5 on mac). See the previous debug session is terminated but the new debug session doesn't start. (Sometimes I get connection refused error popup but not always)
The text was updated successfully, but these errors were encountered: