Repository navigation
fix(relay): a dropped interactive write no longer holds bulk writes back - #62
Merged
Merged
Conversation
…s bulk writes back The relay writer's close linger can drop a waiting interactive write. Its place in the waiting count was never given back, so every later bulk write on that relay waited for good. The count now leaves on drop and wakes the held bulk writes; a waiting interactive write still goes first.
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.
A relay connection's bulk circuits no longer stall for good after an interactive write is cut off mid-wait.
What changed
crates/mousse-relay/src/egress.rs: an interactive write counts as waiting until it takes the bucket or its future is dropped. Before, the relay writer's close linger could drop a waiting interactive write; the count was never lowered, so every later bulk write on that relay waited behind an interactive write that no longer existed. Now the count is lowered on drop and the held bulk writes are woken. A waiting interactive write that is not dropped still goes before bulk.Measurement
A scheduler harness that compiles
egress.rsalone (current-thread runtime, paused clock): empty the bucket, start an interactive write, drop it after 10 ms, then time one bulk write, 20 trials.b757d23Verification
egress::tests::a_dropped_interactive_wait_lets_bulk_go_on(new): with no other interactive write waiting, the bulk write finishes once the bucket refills; with one other interactive write still waiting, that one goes first and the bulk write follows. It fails on main'segress.rs(bulk still held after 2 s).egress::tests::the_ceiling_holds_and_interactive_goes_first(unchanged) still passes: the ceiling and interactive-first order hold.server.rsthat drops the write. The fix is in the scheduler, so it covers any caller that drops a waiting write.cargo fmt --all --check,cargo test --workspace(1,304 passed, 0 failed),cargo check -p mousse-net-core --target wasm32-unknown-unknownandcargo clippy -p mousse-relay --all-targets --all-features -- -D warningspass.cargo clippy --workspacefails on lints in files this PR does not touch, and main's CI fails the same way:mousse-helper/src/app/paths.rs:1321(nonminimal_bool, also on Linux CI), plus, on Windows only,mousse-net-io/src/keystore.rs:1624andmousse-helper/src/app/out.rs:53(thread_localinitializer).