-
Notifications
You must be signed in to change notification settings - Fork 30k
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
DAP - Terminate Request is not sent for "Attach" Configurations #143991
Comments
VS Code has probably a bug here, but the issue is a bit theoretical because I do not really see a way how the "Graceful Termination" of a debuggee can be implemented for the "attach" case, where the debuggee is not under the control of the debug adapter. |
@weinand I don't understand this statement. Perhaps you can provide an example with a specific Debug Adapter that you have in mind? Perhaps there are some Debug Adapter implementations where once connected to a process running a debuggee script/program the Debug Adapter cannot trigger some |
@weinand I have just reread your last comment and I think perhaps you may have misunderstood the request. I am not asking for "Graceful Disconnect" here. I am asking that when the user holds Alt/Option to reveal the "Stop" button (which implies "terminate" to the Debug Adapter), that an extension that has registered for the So when you say:
I'm not suggesting that you add a two-phase disconnect (as #196) does. I'm requesting that VS Code's vscode/src/vs/workbench/contrib/debug/browser/debugSession.ts Lines 325 to 348 in 188b1a5
replace the following line:
with this: if (this.raw.capabilities.supportsTerminateRequest) The This request is simply about fixing "Debuggee Termination (initiated by the Stop button) while in Attach-type Debug Sessions". It has nothing to do with Disconnect flow. |
@ericdrobinson you said in the initial comment:
I have to disagree.
So with the default behavior of the "Stop" command for "attach" configurations the |
@weinand I'm not sure what to say other than I'm a consumer of the DAP and I have an implementation that does not match your expectations.
I guess I don't care who's "responsibility" it is when I have the ability in the debuggee protocol that I'm working with to request that the debuggee terminate itself even when I attached to the running process. Sure, I didn't start the process, but I do still have the ability to request that it shut itself down. What is so sacred about "who started a process" here? Additionally, if you are so darn adamant about this:
Why do you allow the user to switch the UI from "Disconnect" to "Stop" in the UI of an an Note: Please understand that I am maintaining a Debugger Extension that makes excellent use of this feature/capability in a way that enables great workflow for the end user. Removing the |
The fundamental difference between "launch" and "attach" configurations exist in DAP since its inception 6 years ago and 50+ debuggers are using this. Discussions about the history might be interesting for some, but they cannot result in changes to the history (because that would be breaking). So we will have to live with semantics that sometimes does not match your (or any other debug extension author's) expectations. To mitigate these mismatch problems we are always trying to introduce new features that help those debug extension authors that are limited by bad semantics. One example is the This bug report will fix the problem that you describe in your initial comment: |
Ahh, got it. Somewhere I guess we started talking past each other because this is simply what I've been advocating for :)
Ahh, yes, but that doesn't stop you from changing how the DAP implementation in VSCode works (provided it doesn't contradict anything explicitly spelled out in the protocol...) ;-) Though... I admit I didn't check the wording of the relevant content in the docs exactly. Apologies for the confusion! |
Details
Does this issue occur when all extensions are disabled?: N/A
Steps to Reproduce
supportsTerminateRequest
.Expectation
If I implement a Debug Adapter that supports the Terminate Request so that I can handle the two-phase "Graceful Termination", then I expect that functionality to work in both "Launch" and "Attach" configurations. If the user presses the "Stop" button, then this internally indicates "terminate debuggee". This is indicated by the fact that the
terminateDebuggee
Disconnect Request argument istrue
(if support is enabled) when the user presses the "Stop" button. This applies to both "Attach" and "Launch" configurations.Reality
The Terminate Request is never called for Debug Sessions started with "Attach" configurations, even when the user clicks the "Stop" button to trigger termination.
The DAP specification does not suggest that the Terminate Request is limited to work only with "Launch" configurations.
History
The following appear to be related:
terminate
request when ending a debug session #54384It appears that this "rule" was implemented before the Alt/Option feature that allows users to switch between Disconnect/Stop buttons in the UI. When this new feature was under discussion, @weinand wrote the following:
My expectation as a Debug Adapter implementer is that if I support the Terminate Request, then whenever the user initiates termination (e.g. via the Stop button, regardless of how the Debug Session was started) I should receive the Terminate Request. The check for whether to call Terminate Request should no longer check for "Launch" vs "Attach" but, rather, "Terminate" vs "Disconnect".
Perhaps this was simply an oversight during the initial implementation as @isidorn wrote the following:
Which is true, they do - at least the ones that existed prior to this change. The newly added
stop
action (Alt/Option to enable Stop with "Attach" Debug Sessions) appears to have slipped through the cracks as it is not currently included in the "allstop
actions".The text was updated successfully, but these errors were encountered: