Skip to content

Fix threads not fetched after restarting debug adapter#88790

Merged
isidorn merged 1 commit intomicrosoft:masterfrom
dlech:fix-fetch-threads-after-restart
Jan 17, 2020
Merged

Fix threads not fetched after restarting debug adapter#88790
isidorn merged 1 commit intomicrosoft:masterfrom
dlech:fix-fetch-threads-after-restart

Conversation

@dlech
Copy link
Contributor

@dlech dlech commented Jan 16, 2020

A RunOnceScheduler (this.fetchThreadsScheduler) is used to throttle
fetching threads from debug adapters. this.fetchThreadsScheduler is
disposed when a debug adapter is restarted because of:

this.rawListeners.push(this.fetchThreadsScheduler);

This causes threads to never be fetched after restarting the debug
adapter.

This is fixed by setting this.fetchThreadsScheduler to undefined after
it is disposed. This way, a new RunOnceScheduler is created after
restarting the debug adapter.

Fixes #88784

This PR fixes #

A RunOnceScheduler (this.fetchThreadsScheduler) is used to throttle
fetching threads from debug adapters. this.fetchThreadsScheduler is
disposed when a debug adapter is restarted because of:

    this.rawListeners.push(this.fetchThreadsScheduler);

This causes threads to never be fetched after restarting the debug
adapter.

This is fixed by setting this.fetchThreadsScheduler to undefined after
it is disposed. This way, a new RunOnceScheduler is created after
restarting the debug adapter.

Fixes microsoft#88784
@dlech
Copy link
Contributor Author

dlech commented Jan 16, 2020

Hmm... CI errors seem unrelated to this PR.

@dlech
Copy link
Contributor Author

dlech commented Jan 16, 2020

It turns out this was caused as a side-effect of not using language server protocol correctly, not sure if it is a "real" bug or not.

@dlech
Copy link
Contributor Author

dlech commented Jan 16, 2020

The specification says "A debug adapter is expected to send this event when it is ready to accept configuration requests (but not before the ‘initialize’ request has finished)."

So either the specification needs to say "required" instead of "expected" or there is a bug in VS Code.

@isidorn
Copy link
Collaborator

isidorn commented Jan 17, 2020

This fix is good, thanks for providing it. Merging in this PR.

@isidorn isidorn merged commit 19935de into microsoft:master Jan 17, 2020
@isidorn isidorn added this to the January 2020 milestone Jan 17, 2020
@isidorn isidorn added the debug Debug viewlet, configurations, breakpoints, adapter issues label Jan 17, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

debug Debug viewlet, configurations, breakpoints, adapter issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Threads are not fetched after restarting debug adapter

2 participants