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

Support cancellation in DAP communication #80374

Closed
weinand opened this issue Sep 5, 2019 · 8 comments
Closed

Support cancellation in DAP communication #80374

weinand opened this issue Sep 5, 2019 · 8 comments
Assignees
Labels
feature-request Request for new features or functionality verification-needed Verification of issue is requested verified Verification succeeded

Comments

@weinand
Copy link
Contributor

weinand commented Sep 5, 2019

Currently there is no way for the VS Code UI to cancel a long running request in the debug adapter.

Example:

VS Code sends out a variables request which takes very long to complete because the variable is a huge array.
User sees the spinner in the variables view and presses "Step over".
This action should cancel the original variables request, however currently there is no way for VS Code to tell the debug adapter to stop what it is currently doing.

Related issues:

Cancellation in LSP:
https://microsoft.github.io/language-server-protocol/specification#cancelRequest

@weinand weinand added this to the September 2019 milestone Sep 5, 2019
@weinand weinand added the feature-request Request for new features or functionality label Sep 5, 2019
@weinand
Copy link
Contributor Author

weinand commented Sep 6, 2019

@isidorn I've added cancelation support to the "aweinand/cancelation" branch of mock-debug.
Please note: this branch does not contain the fake cancelation via the setVariable request.

@isidorn
Copy link
Contributor

isidorn commented Sep 10, 2019

There is already some infrastrucutre for canceling pending requests here
I plan to use that method, and change the logic if the adapter supportsCancelRequest.
Also currently we only call cancelPending when the debug session terminates. I will change that to always call cancelPending when the session continues.

@weinand
Copy link
Contributor Author

weinand commented Sep 10, 2019

@isidorn just be careful that you do not cancel too much, because that method blindingly cancels all pending requests.

As an experiment you could call that method before the "continue" request even without checking for "supportsCancelRequest".

@isidorn
Copy link
Contributor

isidorn commented Sep 12, 2019

@weinand I went through all the requests and the only ones which make sense to survive between steps is all the setBreakpoint requests.
So to start I will cancel all requests on step. In practice I do not think we will hit issues with this approach, though we shall see if I am wrong.

@isidorn
Copy link
Contributor

isidorn commented Sep 12, 2019

I have pushed the initial support for this. Whenever we step, or a session is stopped we check if the adapter supports cancel request:

  • if yes we send a cancel request for all the pending requests.
  • if not we create a fake cancel response after 500 ms - our old strategy

Try it out and let me know what you think.
It would also be great to have some debug adapter that supports this.
@weinand should we ping our debug extension authors about this addition?

@weinand
Copy link
Contributor Author

weinand commented Sep 13, 2019

What is missing:

  • thread specific cancellation: continuing one thread should only cancel requests for that thread abut leave alone requests for other threads.
  • eval completion in debug console: typing another character should cancel pending CompletionsRequests.

isidorn added a commit that referenced this issue Sep 13, 2019
@isidorn
Copy link
Contributor

isidorn commented Sep 19, 2019

We have tackled all the missing issues as mentioned by @weinand
Though not sure how to verify this via verification-needed since we not have clients that support cancelation. Any ideas @weinand ?

@isidorn
Copy link
Contributor

isidorn commented Sep 30, 2019

Adding verified label since I have no good ideas on how a tester can nicely verify this. I also tested this.
We should get more feedback once clients start adopting this, and then it will be easier to verify this approach.

@isidorn isidorn added verified Verification succeeded verification-needed Verification of issue is requested labels Sep 30, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Oct 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

2 participants