-
Notifications
You must be signed in to change notification settings - Fork 752
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: revisit remote attach disconnect/shutdown implementation #748
Labels
Milestone
Comments
polinasok
added
Debug
Issues related to the debugging functionality of the extension.
DelveDAP
labels
Oct 6, 2020
polinasok
changed the title
debug: Revisit remote attach disconnect/shutdown implementation
debug: revisit remote attach disconnect/shutdown implementation
Oct 9, 2020
Interesting issue filed against dlv suggesting that an interactive prompt on exit is too annoying: go-delve/delve#2324. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
We must differentiate between single- and multi-client debug server when stopping the debug session and disconnecting. Our code appears to be written with the assumption that the remote server is always run with --accept-multiclient, so instead of halting and detaching, it just closes the rpc connection to the server (see here). Leaving the server running makes sense only if it can accept more client connections. Otherwise, we will have a lingering server that is unresponsive and can no longer be connected to (see #497). If the server is not multi-client (check with
RPCServer.IsMulticlient
), it should be killed with halt+detach on disconnect. When the server is killed, we should follow the same pattern as local launch/attach, killing the target process if it was launched withdlv debug
, and letting it run if it was attached to withdlv attach
.We should fix the logging in the code to accurately log when we halt+detach and kill the server/process and when we just close the connection and leave them running. Currently we print "HaltRequest" even when we do not halt, which makes the logs quite confusing.
Optionally we could extend the above default behavior with an additional option to kill the server. This is what
dlv cli
does interactively. I do not know of an interactive way to do this in vscode, but we could come up with alaunch.json
attribute to specify upfront that the server should be terminated on disconnect. Also filed microsoft/debug-adapter-protocol#175 to get this flag into DAP and then vscode.Interestingly, vscode-go adapter always restarts a halted target process on disconnect while
dlv cli
does not. This could be another option to add to the debug configuration. Also filed microsoft/debug-adapter-protocol#177 to get this flag into DAP and then vscode.The shutdown behavior can be explored with the following simple program
And with the following
launch.json
configuration comparing todlv connect :2345
:Then the cases are as follows:
@quoctruong
The text was updated successfully, but these errors were encountered: