Repository navigation
fix: destroy the replication streams a store created when it closes - #187
Open
danielAsaboro wants to merge 2 commits into
Open
danielAsaboro wants to merge 2 commits into
danielAsaboro wants to merge 2 commits into
Conversation
[Medium impact] The PR appears safe to merge; no blocking issues remain. SummaryThe root store now destroys streams it created during close, while leaving caller-owned streams open.
Reviews (2) · Last reviewed commit: "test that streams passed to replicate st..." · 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.
store.close()leaves streams made bystore.replicate(true)/store.replicate(false)open, and they stay instreamTracker. If such a stream is piped to a socket, the socket outlives the store.StreamTracker.destroy()already skips external streams and destroys the rest, but nothing calls it. v6 destroyed these streams on close; the call was lost in the V7 rewrite.The root store now calls
this.streamTracker.destroy()in_closebefore closing the cores. Streams passed in (store.replicate(socket)) are external and left alone, as before.The
replicatehelper intest/groups.jswaited for'close'on both streams in teardown. When the store's own teardown closes it first, that event has already fired. It now skips streams that are already destroyed.validation
The new test in
test/basic.jscloses a store with a live internal stream and waits for the stream's'close'. Without the fix it never comes and the test does not end; with it, the stream is destroyed and untracked. Node and Bare 55/55,npm run lintclean.