Repository navigation
fix(mux): close a pooled connection to a removed backend once it is idle - #1765
Merged
Merged
Conversation
FlorentinDUBOIS
force-pushed
the
fix/mux-retired-backend-cleanup
branch
from
October 1, 2026 18:58
21b1f7e to
d14e332
Compare
A pooled backend connection whose backend left the configuration is no longer reused (#1735), but it stayed open until its frontend session ended, so the removed backend kept a connection and never went from Closing to Closed. Mux::ready_inner now drops such a connection as soon as it carries no stream: an H1 keep-alive, or an H2 connection with an empty stream table. Connection::force_disconnect raises HUP and the dead-backend sweep closes it on the next iteration, releasing its connection on the backend. A reload that changes a backend's weight, sticky_id or backup is applied as RemoveBackend then AddBackend (ConfigState::diff), so live sessions now drop their pooled connection to it and dial it again; documented in CHANGELOG and LIFECYCLE.md. Adds router unit tests for the retired-backend reuse skip in its three arms, and an e2e test for RemoveBackend within a surviving cluster. Fixes #1760 Signed-off-by: Florentin Dubois <[email protected]>
FlorentinDUBOIS
force-pushed
the
fix/mux-retired-backend-cleanup
branch
from
October 1, 2026 20:39
d14e332 to
045f932
Compare
Signed-off-by: Florentin Dubois <[email protected]>
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.
Fixes #1760
What changes
ClosingtoClosed.Mux::ready_innernow drops such a connection once it carries no stream (H1 keep-alive, or H2 with an empty stream table) throughConnection::force_disconnect; the dead-backend sweep closes it and releases its connection on the backend. A connection already idle at removal time is closed on its session's next event.RemovedBackendHasNoConnectionsis unchanged: it fires when the lastRcof the backend drops, which the session'sBackendRegistryholds until the session closes.sticky_idorbackupis applied asRemoveBackendthenAddBackend(ConfigState::diff), so live sessions now drop their pooled connection to that backend and dial it again. CHANGELOG andlib/src/protocol/mux/LIFECYCLE.md.Tests
test_removed_backend_is_neither_reused_nor_kept:RemoveBackendwithin a surviving cluster; the next request reaches the remaining backend and the removed backend's connection is closed. Fails on fix(mux): never reuse a pooled connection to a removed backend #1743's head (connection still open), passes here.a_retired_backend_connection_is_never_reused: the reuse skip of fix(mux): never reuse a pooled connection to a removed backend #1743 for H2 Connected, H2 Connecting and H1 KeepAlive, with a live-backend premise per arm.idle_pooled_backend_names_only_streamless_pooled_connections.Validation
cargo +nightly fmt --all --checkcargo +1.93.1 clippy --all-features --all-targets --locked -- -D warningsRUSTDOCFLAGS="-D warnings" cargo doc --all-features --no-depscargo test -p sozu-lib --all-featurescargo test -p sozu-e2e --locked --features opentelemetry,splice,simd -- remove_cluster_tests mux_tests keep_alivecargo +nightly fuzz buildcheck_doc_citations.pyin its four modes