fix(exthost/#3009): Call '$release*' APIs to clean-up extension host cache #3016
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.
Issue: There is a memory leak in our completion items, signature help, and codelens via the extension host - may be responsible for the
SIGABRT
described in #3009 (as this can occur when the JS heap is out of memory).Defect: The extension host adds a layer on top of the language server protocol, to serve as a cache for several language features - this helps performance when resolving items. However, this caching layer relies on the client to notify it when the items are no longer in use, so they can be cleaned up. Onivim was missing this
release
step.Fix: Bake in the call to
release
in all the relevant subscriptions. This involves picking up thecacheId
which wasn't wired up in some places (like codelens), setting up therelease*
API, and passing it back on conclusion of the subscription.To test this fix - I flipped the
Cache.enableDebugLogging
flag in the extension host and initiated several completions. Before this fix, it's obvious the caches were simply growing endlessly:After this fix, though, we can observe that the cache gets cleaned:
Related #3009
Related #1058