fix(translator): eagerly mark_closed on malformed-JSON disconnect (#241) - #281
Open
ANAMASGARD wants to merge 1 commit into
Open
fix(translator): eagerly mark_closed on malformed-JSON disconnect (#241)#281ANAMASGARD wants to merge 1 commit into
ANAMASGARD wants to merge 1 commit into
Conversation
Closes dmnd-pool#241 Before this commit, mark_closed() only ran after the receive loop exited. A deferred bootstrap task reading is_closed() between the break and the post-loop teardown could observe a live session for an already-dead connection. Add eager mark_closed() at the malformed-JSON break site and regression tests that assert full teardown (closed flag, stats removal, kill signal) on invalid input.
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.
Summary
mark_closed()at the malformed-JSON break site in the SV1 downstream receive loop so deferred bootstrap tasks cannot observeis_closed == falsefor a connection that is already dead.mining.notify.Fixes #241
Context
Malformed JSON previously used
returninside the receive task, which skipped post-loop teardown (mark_closed, stats cleanup, kill signal). That was fixed tobreakin 0076242, and notify/bootstrap guards were added in d1c3fb3. This PR closes the remaining race window betweenbreakand post-loopmark_closed(), and locks the behavior in with tests.Changes
src/translator/downstream/receive_from_downstream.rsmark_closed()on malformed JSON + 2 regression testsNo changes to
downstream.rs,notify.rs, or bootstrap registration.Test plan
cargo test malformed_json— 2 new tests passmalformed_json_triggers_full_teardownmalformed_json_races_deferred_bootstrapcargo test receive_from_downstreamcargo test— full suite greencargo clippy -- -D warnings(CI)cargo fmt --check(CI)