Repository navigation
fix(selene): fix pool client event-loop starvation, fencing, backpressure, and overflow bugs - #611
Merged
Conversation
yatesdr
force-pushed
the
fix/selene-pool-client-reliability
branch
3 times, most recently
from
November 29, 2026 17:27
1e759b6 to
bf4ee52
Compare
The pool client engine and connection loop could starve outbound fills and engine timers under active traffic, drop fence acknowledgments for rejected or cancelled puts and lost sessions, livelock when resyncs exceeded the outbound channel buffer, or overflow staging calculations on untrusted manager limits. - Drain completed host fills in `Engine::pump_flow` and replace the resetting per-select sleep in `conn::serve` with a persistent `next_tick` deadline (`selene/src/pool/engine/mod.rs`, `selene/src/pool/conn.rs`). - Pause index resync/notice flow when the outbound gRPC channel lacks headroom, apply non-blocking `tx.reserve()` backpressure instead of disconnecting on transient channel fullness, and preserve queued `FenceAck`, `ExportEnd`, and `WindowReleased` messages in `owed` on session loss (`selene/src/pool/conn.rs`, `selene/src/pool/engine/mod.rs`). - Transition puts to `Phase::Accepted` upon `PutAccept` so all local rejection branches emit `FenceAck(Drained)`, answer late `PutAccept` for already-cancelled puts with `PutCancel` + `FenceAck(Drained)`, and reject `accept.packed = true` for raw puts (`selene/src/pool/engine/writer.rs`). - Use saturating/checked arithmetic in `staging_slots`, `Staging::planned_bytes`, and `Staging::new`, reject reconnects whose `max_window_bytes` exceeds registered staging, and strip IPv6 brackets when dialing the data channel (`selene/src/shared/limits.rs`, `selene/src/pool/net.rs`, `selene/src/pool/engine/netio.rs`, `selene/src/pool/conn.rs`). - Bound `RankAgent::wind_down` goodbye sends with a timeout, clear `jobs`/`pending` on `Agent::quarantine`, retain pins until partially opened export peers report `Done`, report `CopyChecksum` on packed checksum failures, remove `from` before inserting `to` in `Announcer::spilled`, and guard empty rendezvous replies in `pool_peer` (`selene/src/pool/agent.rs`, `selene/src/pool/engine/source.rs`, `selene/src/pool/engine/requester.rs`, `selene/src/pool/announce.rs`, `selene/src/pool/peers.rs`). Pool sessions no longer stall puts or timers under load, leak manager put slots or staging windows on cancelled/rejected accepts, livelock during large resyncs, or panic on invalid limits or rendezvous replies. Validated on GB10 (`cn6`): - `cargo test --manifest-path selene/Cargo.toml --features codec --release`: 515/515 lib + 1/1 `mixed_codec_root` passed (including new tests `late_or_rejected_put_accept_always_emits_fence_ack_drained`, `session_lost_preserves_unsent_fence_messages_for_next_session`, and `staging_slots_saturates_instead_of_overflowing`). - `cargo test --manifest-path selene-manager/Cargo.toml --release --lib --test client --test offload --test packed --test pool_claims --test pool_store --test pool_net`: 180/180 lib + 149/149 integration tests passed across `client`, `offload`, `packed`, `pool_claims`, `pool_store`, and `pool_net`. Signed-off-by: yatesdr <6937857+yatesdr@users.noreply.github.com> Design-Signed-Off-By: yatesdr; design-review=2e5b
yatesdr
force-pushed
the
fix/selene-pool-client-reliability
branch
from
November 29, 2026 17:31
bf4ee52 to
aac8f4f
Compare
Collaborator
|
A case file has been opened for 611. Future reviews will auto-run 90 minutes after code updates are pushed.
|
Collaborator
Review StoppedAuto-Review halted due to finding: It was already fixed another way (merged or on the main branch), or is no longer needed for another reason. |
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.
Why this change is needed
Under active traffic, disconnects, or untrusted manager metadata, the Selene pool client engine and connection loop could stall, drop required fence acknowledgments, livelock on resync, or overflow staging calculations:
Engine::pump_flowdid not draincollect_outbound_fills(), andconn::servecreated a freshsleep(tick)on everytokio::select!iteration, starving outbound fills and periodic engine ticks while control messages arrived.on_put_acceptcould dropFenceAck(Drained)when aPutAcceptarrived late for an already-cancelled put, did not transition toPhase::Acceptedbefore handling errors, and acceptedaccept.packed = trueon raw puts.session_lostdropped queued fence-class messages inself.owed.staging_slots,Staging::planned_bytes, andStaging::newused unchecked arithmetic on manager-supplied limits; reconnect did not recheckmax_window_bytes;conn::dialdid not strip IPv6 brackets;RankAgent::wind_downcould block indefinitely on send; partial-openTP >= 3exports could drop pins early; packed checksum failures were misclassified;Announcer::spilledupserted before removingfrom; and empty rendezvous lists were not guarded inpool_peer.Fixing each mechanism directly inside
selene/src/pool/andselene/src/shared/limits.rshardens the client state machine without altering the gRPC protocol or runtime architecture.What changed
selene/src/pool/engine/mod.rs,selene/src/pool/conn.rs): Draincollect_outbound_fills()inEngine::pump_flowand replace the per-select resettingsleep(tick)inconn::servewith a persistentnext_tickdeadline.selene/src/pool/engine/writer.rs,selene/src/pool/engine/source.rs): Transition toPhase::Acceptedat the top ofon_put_accept, emitPutCancel+FenceAck(Drained)for latePutAccepton already-cancelled puts, rejectaccept.packed = trueon raw puts, hold partial-openTP >= 3export pins until opened peers reportDone, and classify packed checksum failures asCopyChecksum.selene/src/pool/conn.rs,selene/src/pool/engine/mod.rs): Pauseflow_indexwhen outbound channel capacity is<= 64, applytx.reserve()backpressure instead of disconnecting on transient fullness, preserve queued fence-class messages inself.owedacrosssession_lost, and strip IPv6 brackets inconn::dial.selene/src/shared/limits.rs,selene/src/pool/net.rs,selene/src/pool/engine/netio.rs,selene/src/pool/engine/requester.rs,selene/src/pool/agent.rs,selene/src/pool/announce.rs,selene/src/pool/peers.rs): Use checked/saturating math instaging_slots,Staging::planned_bytes, andStaging::new; verifymax_window_byteson reconnect innet_staging; add a 2s send timeout inRankAgent::wind_downand clearjobs/pendingonquarantine; removefrombefore upsertingtoinAnnouncer::spilled; guard empty rendezvous lists inpool_peer.selene/src/pool/engine/tests.rs): Addedlate_or_rejected_put_accept_always_emits_fence_ack_drainedandsession_lost_preserves_unsent_fence_messages_for_next_session.Expected benefit and measured result
The pool client now makes steady progress under high message rates, never wedges the manager waiting on dropped fence acknowledgments, handles outbound gRPC saturation cleanly without reconnect storms, and rejects overflowing staging/window limits safely.
Supporting evidence
#607main(5df8edd3c):RUSTFLAGS="-D warnings" cargo check --locked --manifest-path selene/Cargo.toml --all-targets --features codec,rdmaandselene-manager --lib --bins: passed with 0 warnings.cargo test --locked --release --manifest-path selene/Cargo.toml --features codec --lib: 542/542 passed.flare run+selene-managerpool retirement and cold-start pool-only restores on SM120 (cn5:Qwen3.8-Flash-NextTP1/TP2,GLM-5.3-FlashTP2/TP4,DeepSeek-V4.1-Flash-1017TP4) and cross-host TCP streaming on GB10 (cn6–cn9, 300–400 stream windows across 3-node TP2 and 4-node TP4): 0 disconnects, 0 leaked pins, 0 quarantined bytes, bit-exactpos0parity.#496/#497/#607, and CPU tests were re-run after rebasing onto5df8edd3c.Discord: D-Rock