Repository navigation
Dispose workspace diagnostic progress handler on all paths - #1905
Merged
Dirk Bäumer (dbaeumer) merged 1 commit intoOct 22, 2026
Merged
Dirk Bäumer (dbaeumer) merged 1 commit into
Dirk Bäumer (dbaeumer) merged 1 commit into
Conversation
provideWorkspaceDiagnostics registered a partial result progress handler before checking whether the client was running. It also skipped disposing that handler when the request was cancelled or when converting the report threw. Workspace pulls repeat every 2 seconds, so the leaked handlers accumulated. Check isDisposed/isRunning before registering the handler, and dispose it in a single finally after the request settles.
There was a problem hiding this comment.
🟢 Approval recommended
The focused cleanup change addresses the reported leaks, includes targeted regression tests, and has no identified blocking issues.
No open issues 🎉
What changed in this PR
Fixes workspace diagnostic progress-handler leaks in the language client, preventing handlers from accumulating across repeated pulls.
Changes:
- Checks client state before registering a progress handler.
- Uses
finallyto dispose the handler after success, cancellation, request failure, or report-conversion failure. - Adds regression tests for stopped clients, cancellation, and conversion errors.
| File | Description |
|---|---|
| client/src/common/diagnostic.ts | Moves the client-state guard and centralizes progress-handler cleanup. |
| client-node-tests/src/integration.test.ts | Adds handler-tracking support and regression tests for the reported leak paths. |
Review effort: Balanced
Dirk Bäumer (dbaeumer)
approved these changes
Oct 22, 2026
Alex Ross (alexr00)
approved these changes
Oct 22, 2026
Federico Brancasi (federicobrancasi)
approved these changes
Oct 22, 2026
Trivikram Kamat (trivikr)
deleted the
client-diagnostic-on-progress-handler
branch
October 26, 2026 19:09
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
provideWorkspaceDiagnosticsleaked its partial result progress handler on three paths:isDisposed/isRunning()check, so the early return left it in place.token.isCancellationRequestedearly return skippeddisposable.dispose().convertReportthrows: the throw happens in the fulfillment callback, which the sibling rejection callback doesn't catch, so neitherdispose()ran.Workspace pulls repeat every 2 seconds, so leaked handlers accumulate in the client's progress handler map.