Stop leaking handled statuses in StatusManager - #4366
Open
vogella wants to merge 1 commit into
Open
Conversation
A status handed to addLoggedStatus is only removed again once the very same instance comes back through the log listener. That never happens when the listener was not registered because the platform is not running, or when the public addLoggedStatus is called without a following log, so the entry stays for the life of the singleton and keeps its exception and stack trace alive. Hold the entries in a weak set instead. That also drops the Vector, whose per-call locking never made the contains-then-remove pair atomic anyway. Assisted-by: multiple AI agents and layers of automated tooling 🤖
Contributor
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.
StatusManagerparks every status handled with theLOGstyle in a list and only drops it again once that very same instance comes back through its own log listener. For callers where that never happens the entry stays for the life of the singleton, and each one can keep an exception and its stack trace alive. Two such cases exist today: the listener is only registered when the platform is running, and the publicaddLoggedStatuscan be called without a following log.Holding the entries in a weak set fixes that without changing the handshake, and it lets the
Vectorgo, whose per-call locking never made thecontains-then-removepair atomic anyway.The new
StatusManagerTestfails on the old implementation (the reference is never enqueued) and passes on the new one.