Repository navigation
fix: track sessions by discovery key so cores opened without a key are gc-ed - #188
Open
danielAsaboro wants to merge 1 commit into
Open
danielAsaboro wants to merge 1 commit into
danielAsaboro wants to merge 1 commit into
Conversation
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryTracks sessions by the hex discovery key instead of
Reviews (1) · Last reviewed commit: "track sessions by discovery key" · Reviewed by Greptile |
This branch has not been deployed
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.
get()and_preloadfile a session underthis.sessions.get(core.id). A core created from a discovery key has no key yet, socore.idisnulluntil it opens. That coversget({ discoveryKey })on a core that isn't loaded, andget({ name })after a restart, where the alias lookup returns a discovery key. Those sessions go into a sharednullbucket._ongclater gcs by the real id, so thenullbucket is never removed:store.sessions.sizestays at 1 after every session is closed, andstore.sessions.list()misses those sessions.SessionTrackeris now keyed by the hex discovery key, the same idCoreTrackeruses, which is always known when the core is opened. The three existing assertions that calledstore.sessions.list(core.id)now pass the hex discovery key.validation
The new test in
test/basic.jsreopens a store, gets a named core twice and closes both sessions. Without the fix,list()returns 0 sessions andsessions.sizestays 1; with it, both sessions are tracked and the entry is removed. Node and Bare 55/55,npm run lintclean.