#1 [high] Change: what #609 actually does, file by file (verified in diff)
PR #609 (merged 2026-11-29 17:27, head 304dd3a, +225/−71, 15 files, 0 reviews, 0 comments). Branch fix/selene-dma-lifetime-safety onto main (base 5df8edd3 = #607). Merged ~9 min after opening (opened 17:08, merged 17:27).
Verified hunks:
- selene/src/memory.rs: +33/−10. (a)
MemoryStorefield order changed:transfers: SharedCopiermoved BEFOREcore: Core(memory.rs:2240-2245) so Drop joins copy threads before the slab core unmaps; comment now "checksum, async compression, and copy threads access slabs the core owns". (b)AsyncCompressor::pump_spawnsgets a localstruct ActiveGuard(Arc<(Mutex<usize>,Condvar)>)withDropdecrementingactiveandnotify_allat zero (memory.rs:2024-2038), replacing the manual decrement afterencode_host_task(so a panic in the encoder no longer leaks the counter and hangsAsyncCompressor::drop's condvar wait at memory.rs:2043-2053). (c)MemoryStore::close(memory.rs:3074-3120) now also computescompressor_busy, callstransfers.close(), callscore.pool.leak()if either the copier close failed OR the compressor is still busy, and if the compressor is busy itmem::forgets the compressor and returnsErr("host KV compression did not finish before close")instead ofcore.abandon(). - selene/src/disk_store.rs: +2/−2 only — field order:
transfers: SharedCopiermoved beforepool: Option<SlabPool>inResources(disk_store.rs:208-226). - selene/src/composite.rs: +3/−3 —
CompositeStore::close(composite.rs:1605-1627) now evaluates BOTHself.disk.close()andself.memory.close()before clearing state and returnsdisk.and(memory)— previouslyself.disk.close()?short-circuited and skipped memory close. - selene/src/disk.rs: +4/−0 —
ReadAhead::start(disk.rs:2027-2054) now, under#[cfg(windows)], callsring.queue.attach(&file)afterRing::new(), matching the existing attach contract used by the record writer (disk.rs:986-990) and reader (disk.rs:1296-1300). - selene/src/pool/engine/mod.rs: +7/−1 —
Engine::quarantine(mod.rs:549-573) madepub(crate); in addition to existingdraining/netforgets it nowmem::forgetssess.regions(mod.rs:558-560) andAttachment::Shm{regions,..}(mod.rs:561-563). - selene/src/pool/conn.rs: +1 —
shutdown(conn.rs:208-224) callsengine.quarantine()on the timeout path before returning the "could not drain its transfers at close" error. - selene/src/pool/agent.rs: +3 —
Agent::quarantine(agent.rs:1710-1741) now alsomem::forgetsself.shared'sRegions(agent.rs:1732-1734). - selene/src/pool/net.rs: +3/−7 —
Staging.regionbecomesArc<Region>(net.rs:60-98) andrdma::Device::opentakesArc<Region>(net.rs:108-125). - selene/src/pool/rdma.rs: +9/−13 —
mine/verbsDevicegains_region: Arc<Region>(rdma.rs:31-63) dropped afteribv_dereg_mr(rdma.rs:66-71);openis no longerunsafeand takesArc<Region>; absent-module stub signature follows (rdma.rs:121-127). - selene/src/shared/slice.rs: +68/−2 —
SliceLayout::newnow useschecked_addfor the cumulative page/row record sizes (slice.rs:69-75, new errors "page record size overflow"/"row record size overflow"); newunsafe fn scatter_disjoint(rank, window: *mut u8, window_len, pages, row, packed)(slice.rs:208-248) which validates viacheckand doesptr::copy_nonoverlappinginto only that rank's slices; new testscatter_disjoint_matches_gather_across_ranks(slice.rs:446-462). - selene-manager/src/regions.rs: +58/−8 — factors bounds checking into
fn range(...) -> io::Result<(*mut u8,usize)>, addsunsafe fn bytes_read(&self,...) -> io::Result<&'a [u8]>(regions.rs:47-57) and safeptr_mut(regions.rs:59-66);bytesreusesrange. New testbytes_read_allows_overlapping_shared_views(regions.rs:132-146) plus two new negative asserts in the existing bounds test (regions.rs:127-128). - selene-manager/src/data/channel.rs: +12/−14 — three send-side
regions.bytes(...)calls becomebytes_read(...)(channel.rs:736-741, 780-784, 790-797); the receive-side rank scatter (channel.rs:934-942) replaces a&mut [u8]frombytes+layout.scatter(*rank, whole, ...)withptr_mut+unsafe layout.scatter_disjoint(...). Slimmed the SAFETY comment. - selene-manager/src/pool/pass.rs: +1/−1 —
runusesbytes_read(pass.rs:171-175). - selene/src/pool/engine/tests.rs: +20 — new test
mid_session_quarantine_retains_active_session_and_attachment_regions(tests.rs:1571-1589). - selene/src/offload/tests.rs: +1/−10 — the expected close-order assertion in
disk_and_memory_share_one_registration_with_independent_copiers_and_safe_close(offload/tests.rs:616-675) shrinks from a 3-way conditional toif warm == 0 { vec![0] } else { vec![1,0] }: thefail == Some(1)case (disk close fails ⇒ memory never closed) no longer exists. Test is an existing #497-era test being re-pinned to the new behaviour.
#2 [high] Change: what the description says that the diff does not do, and undeclared edits
Undeclared in the description but present in the diff:
SliceLayout::newchecked-arithmetic hardening (selene/src/shared/slice.rs:69-75) — newchecked_addon the cumulative page/row record sizes with two new error strings. The description never mentions it; it is the same class of overflow hardening as #610/#612 (see #612's "checked arithmetic in windows::plan"), so it overlaps that series.- The removal/relaxation of an existing regression assertion in selene/src/offload/tests.rs:658-659 (
disk_and_memory_share_one_registration_with_independent_copiers_and_safe_close, added under #497). The old expectations encoded "disk close fails ⇒ memory is never closed" (fail == Some(1) => vec![1]); the new code closes both unconditionally, so the test had to change. Declared only vaguely as "close both disk and memory in CompositeStore::close". Engine::quarantinevisibility widened from private topub(crate)(engine/mod.rs:549) — needed by conn.rs, but a new crate-visible entry point.rdma::Device::openchanged fromunsafe fnto a safefntakingArc<Region>(rdma.rs:44-63; absent stub rdma.rs:123-127) — an API/signature change insidepub(crate), not a public API.
Description says but diff does not (or only weakly) do:
- "Declare
transfersbeforecore/pool" — done, but note field ORDER is the entire mechanism here (Drop order), so it is a subtle, comment-only-visible invariant;disk_store::Resourcesstill keepsdisk: DiskThreadfirst and movestransfersonly ahead ofpool(disk_store.rs:208-226), i.e. slab pool unmap now precedes copier drop. - "zero latency or parity regression on SM120 and SM121" — see the claims/evidence note; no benchmark of its own is presented for #609.
- Windows IOCP attach: description itself concedes it was never compiled or run on Windows.
#3 [high] Claims vs evidence: #609's supporting evidence is a combined 4-PR run, not a standalone one
Claimed in the body:
- Standalone:
RUSTFLAGS="-D warnings" cargo check --locked --manifest-path selene/Cargo.toml --all-targets --features codec,rdmaandselene-manager --lib --binsclean;cargo test --locked --release --features codec --lib541/541. Self-reported, no CI link, no log. Compare sibling PRs opened the same minute: #610 and #611 both claim 542/542, #612 claims 540/540 — i.e. the counts differ per branch, so 541 is plausible but unverifiable here. - Hardware:
FLARE_RUN_CUDA_TESTS=1SM120 4× RTX PRO 6000 28/28helios::offload::CUDA tests; baseline-vs-patchedflare run+selene-manageracross DeepSeek-V4.1-Flash-1017 TP4, GLM-5.3-Flash TP2/TP4 (off/cpu/gpu), Qwen3.8-Flash-Next TP1/TP2 on SM120 and multi-host TP2/TP4--roce-ringon GB10 cn6–cn9: 0 panics, 0 quarantined bytes, bit-exact pos0, clean SIGTERM. The body itself states this ran on the COMBINED 4-PR stack (#609/#610/#611/#612) BEFORE rebasing onto #496/#497/#607; only CPU tests were re-run post-rebase. So no hardware evidence exists for #609 alone, and the CUDA tests named arehelios::offload::, which #609 does not touch (helios is untouched by this PR) — that evidence is about the stack, not this diff. - "zero latency or parity regression on SM120 and SM121" — the only quantitative statement is "bit-exact pos0 parity"; no latency numbers, no throughput numbers, no benchmark table are given. Under the charter ("Performance PRs need benchmarks showing an actual speedup over main", "Bring real evidence") this is a bug-fix PR so benchmarks are not strictly required, but the zero-regression claim is unsupported by numbers.
- Three new tests are named in the body and all three exist in the diff: engine/tests.rs:1571-1589, shared/slice.rs:446-462, selene-manager/src/regions.rs:132-146. Note the third tests
bytes_readonly;ptr_mutgets only negative bounds asserts (regions.rs:128), andscatter_disjointis exercised only for a single-threaded 3-rank round trip, not for actual concurrency. - Material limitation disclosed honestly: Windows
#[cfg(windows)]attach "reviewed … but not compiled or executed on Windows".
#4 [high] Process: merged in 19 minutes, no review, CI failed on head, autobot review not run
- Opened 2026-11-29 17:08, merged 17:27 the same day by the author's own account flow (author yatesdr is a COLLABORATOR). 0 reviews, 0 comments, no labels on #609 (contrast: #607 carries area:caching/area:selene/bug/duplicate/triage:review; #611 area:selene/bug/performance/triage:review; #612 area:selene/bug/triage:review).
- Orientation packet: "CI on the head commit: failed" (304dd3a). I could not read the failing job from here; the relevant workflow that touches these files is
.github/workflows/native-serving.yml(Linux selene+selene-manager tests at :48-52, Windows selene tests at :53-55, a separaterdmajob at :101-113 that only doescargo check)..github/workflows/helios-lifecycle.yml:7-8also triggers onselene/**andselene-manager/**. - No autobot case file / review was posted on #609. The sibling PRs opened in the same minute all have an autobot intake comment: #607 got a full "Ready To Merge" review at 17:32; #610 has none; #611 and #612 got "Review Stopped — already fixed another way / no longer needed" at 17:46 and 17:51. So of the 4-PR batch, only #607 was actually reviewed.
- The PR is described as "merged, ready for review" in the packet, i.e. it landed before any review could happen.
#5 [high] Related work: the 4-PR batch (#609/#610/#611/#612) and #607 they were all rebased onto
- #607 "selene,selene-manager,helios: fix pool staging UAF, chain walk DoS, multi-process put corruption, and offload lifecycle bugs" by lukealonso, merged 17:17, +1211/−41, 16 files. #609's base commit is 5df8edd3, the merge of #607. #607 and #609 mutually "mention" each other. #607's autobot review explicitly says "Companion PRs #609, #610, #611, #612 by yatesdr are already rebased onto #607 (overlapping hunks removed, #607 referenced explicitly)".
- #610 "fix local storage tier, input cache, sharding, and codec edge cases" opened 17:08, merged 17:28, +597/−158. Touches selene/src/memory.rs, composite.rs, disk.rs, disk_store.rs — the same files as #609's store-teardown half. Its fixes (e.g.
Sharded::closeonly marking closed on success,Peer::shutdowndrained-vs-leak) are the same "teardown must retain until drained" theme. - #611 "fix pool client event-loop starvation, fencing, backpressure, and overflow bugs" opened 17:08, merged 17:32, +260/−43. Touches selene/src/pool/agent.rs, conn.rs, engine/mod.rs, net.rs, engine/tests.rs — 5 files in common with #609, including
Agent::quarantine(it addsself.jobs.clear(); self.pending.clear()there) andconn::shutdown. So #611 EDITED the same quarantine functions #609 edited, one commit later (8d05b9b6 is the merge of #611, after e2522eb0 = #609). The two are complementary, not conflicting, but the quarantine path's final shape on main is #609 + #611 combined. - #612 "harden multi-rank packed handling, protocol validation, and resource reclamation" opened 17:08, merged 17:32. It REJECTS multi-process (
world >= 2) packedPutBegin/PinAckgrants — i.e. it closes off part of the multi-rank packed path whose scatter#609just made alias-free. Autobot's review of #612 was "Review Stopped — already fixed another way / no longer needed". - All four say "Discord: D-Rock" and all four share the same "Combined 4-PR validation & SM120/SM121 hardware qualification" evidence block with the same limitation wording ("live hardware qualification ran against the combined 4-PR stack before rebasing onto #496/#497/#607"). That is one qualification run cited four times.
#7 [high] Why: the defects, and evidence that the "why" is self-asserted rather than reported
The PR links no issue, no crash dump, no reproduction, no user report. It refers to only #496, #497, #607. The defects it describes are of four kinds:
- Droporder/lifetime: slab pools unmapped before transfer/compression threads joined (memory.rs, disk_store.rs);
CompositeStore::closeskippingmemory.close()whendisk.close()failed;AsyncCompressoractive-counter leak on panic and slab-pool unmap after a close timeout. - Quarantine retention:
Engine::quarantine/Agent::quarantine/conn::shutdowndropping mapped regions while a peer/copier still referenced them;rdma::Devicenot retaining the staging region for a quarantined QP. - Rust UB: overlapping
&mut [u8]fromLocalRegionsacross concurrent readers and multi-rank scatter. - Windows:
ReadAheadoverlapped handle not attached to its IOCP. Only (1)'sCompositeStore::closeshort-circuit and (4)'s IOCP attach are plainly visible as unconditional defects from reading the code; (2) depends on quarantine actually firing (a rare timeout path:CLOSE_TIMEOUT), and (3) depends on two data-channel handlers for the same failing put/rank actually overlapping. Worth noting as context that exists in the repo: #607 (merged 10 min earlier) already fixed a related and reported-by-review class of the same bug — staging-slot double release enabling "concurrent&mut [u8]aliasing" andwithdraw_queuedreleasing windows while a peer rank still had in-flight DMA. #607's autobot review is the closest thing to an independent confirmation that this area had real aliasing/UAF bugs. #607's fixes were in claims.rs, agent.rs, requester.rs, net.rs; #609 then generalises the same theme to quarantine, RDMA staging, and the manager's scatter. Most likely origin: an audit of Selene by the same author in one day, producing 4 PRs of the same shape (see the batch note). There is no evidence the defects were hit in the field.
#16 [high] Research summary
I covered all nine angles for PR #609 and saved 15 scratchpad entries: one sheet of the verified 15-file diff, one on description/diff mismatches, one on claims vs evidence, one on process (merged in 19 minutes, no review, CI failed on head, no autobot case file), two on related work (the #609/#610/#611/#612 batch stacked on #607, and the same-file lineage #92/#380/#497/#496/#504), one each on the why, recent activity, people, project fit, reach and the packet's lead coverage log, plus a verified-premise note on the manager's per-connection task model and a reader checklist.
The main things a downstream reader could not get from the description: the diff also adds checked-arithmetic hardening to SliceLayout::new (undeclared, and the same class as #612's work); it relaxes an existing #497-era regression assertion in selene/src/offload/tests.rs that previously proved memory is not closed when disk close fails, so that short-circuit can no longer be caught by that test; MemoryStore::close can now return a new error operators will see ("host KV compression did not finish before close"); and conn::shutdown now quarantines — retaining all regions for process lifetime — on its timeout path, a retention widening no doc mentions. The whole hardware-evidence block is one combined 4-PR run done before the rebase and cited verbatim by four sibling PRs, so no hardware evidence exists for #609 alone; the "zero latency/parity regression" claim carries no numbers, and the named CUDA suite is helios::offload::, which this PR does not touch. The Windows IOCP change is the only unexercised build path, and the failing CI on head could not be attributed from here.
Unresolved: I could not identify which CI job failed on 304dd3a.
#6 [medium] Related work: same-file history — #92 (origin of the pool), #497/#496 (the tests and disk paths touched), #380 (RDMA), #504
related_items for #609 lists 20+ PRs sharing files. Most relevant:
- #92 "Share prefix KV cache between instances and hosts through a selene pool manager" (merged, by yatesdr): 15 files in common — essentially every file #609 touches. It is the origin of the pool, the data channel, and
LocalRegions. - #380 "Select the Selene RDMA device on the data connection's route" (merged, yatesdr): shares selene-manager/src/data/channel.rs, selene/src/pool/net.rs, selene/src/pool/rdma.rs — i.e. the
Staging::rdma/ staging-region registration code that #609 now wraps inArc<Region>. Commit c7ee0780 2026-11-18 is the last change to selene/src/pool/rdma.rs before #609. - #497 "Reduce disk offload restore latency and integrated-memory intake overhead" (FujitsuPolycom, merged 2026-11-29): owns
disk_and_memory_share_one_registration_with_independent_copiers_and_safe_closein selene/src/offload/tests.rs, the exact test #609 relaxes. #497's own comment reports "475 Linux selene tests, 83 selene-manager --test client, 6 Windows IOCP tests, 21 single-GPU SM121 helios offload:: tests" — i.e. #497 did run Windows IOCP tests; #609 doesn't. - #496 "Coalesce shared ancestor reads across concurrent Selene disk fetches" (merged) — also reports Windows IOCP tests (13) at its head. #609's Windows change is unverified by comparison.
- #504 "pure-CUDA GPU and CPU lossless KV compression" (merged, yatesdr): 12 files in common; it is the PR that introduced
AsyncCompressorand thecompressor: Option<AsyncCompressor>field whose panic-leak and busy-close behaviour #609 fixes. - #141, #168, #415, #413, #429, #524, #142, #101 — earlier yatesdr Selene series sharing memory.rs/composite.rs/disk_store.rs. #609 is the newest entry in a long, single-author lineage of Selene store fixes.
- #255 (open issue) "Host prefix cache: ~30% of hits dropped as capacity_rejected and fully recomputed" mentions composite.rs, but is unrelated to lifetimes; no indication #609 addresses it.
#8 [medium] Community/People: author history, who else works here, engagement on #609
- Author yatesdr, COLLABORATOR, 79 merged PRs in 180 days (plus 9 closed, 4 open). Areas: helios/src (34), docs (33), selene/src (32), selene-manager/src (25), selene-manager/tests (20). They are the dominant committer in selene/src (36 commits in 180 days vs Luke Alonso 5, Martin Vit 2) and selene-manager/src (30 vs 3). Effectively the owner/maintainer of the Selene cache code.
- Note the charter's priority-contributor list is
@voipmonitor,@original-el8,@lukealonso— yatesdr is not named there, but is a collaborator with the largest recent footprint in these files. - Who else works here: Luke Alonso (@lukealonso, priority contributor) authored #607, the PR this one is stacked on, and touched selene/src/pool/agent.rs, net.rs, engine/tests.rs; PCCessna (FujitsuPolycom) authored #496/#497, which own the offload test #609 modifies.
- Engagement on #609 itself: none. 0 comments, 0 reviews, no labels, merged by the author within 19 minutes. The only cross-PR attention is #607's autobot review naming #609 as a companion.
- Author's concurrent output: PRs #610, #611, #612 and #609 all opened within the same minute (17:08). They were merged 17:27–17:32 in the order #609, #610, #611, #612, and all four are cross-referenced as a batch.
#9 [medium] Recent activity: what changed in these files lately and how #609 sits with it
Same-day, immediately preceding merges into main that touch the exact files:
- 5df8edd3 (#607) — the rebase base; fixes staging-slot double release /
&mutaliasing and peer-DMA-gated window release (selene/src/pool/agent.rs, net.rs, engine/requester.rs, engine/tests.rs; selene-manager/src/pool/claims.rs). - f7256584 (#496) and dad2fa56 (#497) — PCCessna's disk-fetch coalescing and restore-latency work; #497 owns the offload test #609 relaxes.
- 716df00f (#504, 2026-11-25) — introduced
AsyncCompressorand thecompressorfield. - ad72c493 "Require pool attachment at startup and register pool memory off the I/O thread" (#365-era) — introduced
Attachment/attachmentand the "first connect decides" registration contract in conn.rs:590-675 thatEngine::quarantinenow has to unwind safely. - c7ee0780 (2026-11-18, #380) — last touch of selene/src/pool/rdma.rs before this PR.
After #609 landed came 8d05b9b6 (#611), a56333a0 (#610), 3801ff1b (#612): #611 edits
Agent::quarantine(adds jobs/pending clear) andconn::shutdownagain, #610 and #612 edit the store/manager tiers. So #609 neither reverses nor is reversed by them; it is the middle of a same-day pile-up, and #611's edit means #609'sAgent::quarantinehunk is not the final form on main. Also on the same day in the touching areas: 3801ff1b (#612) addswave/pad hardening to selene-manager; e67d5dee/0793b687 are docs/docker, irrelevant.
#10 [medium] Project fit: charter mapping for #609
Lines up:
- Goals: "Store prefix-cache checkpoints in host memory and share them across Flare instances via Selene." The whole PR is lifetime-safety for that host-memory/Selene pool path.
- "Bring real evidence … Bug fixes need to address the root cause; don't just swallow, skip, or retry an unexplained error." Mostly yes in spirit (leak/forget instead of free is deliberately not swallowing — it retains ownership), but two of the "fixes" ARE of the form "keep it alive forever / never free it":
core.pool.leak()(slab.rs:404-409 forgets the mapping),mem::forget(compressor),mem::forget(regions)in both quarantine paths,mem::forget(self.shared). That is the pre-existing project idiom for quarantine (seeEngine::quarantinedoc "keep every pin, mapping and registration for the life of the process"), so it is consistent, not novel. It does, however, mean the change intentionally makes a rare failure path leak memory until process exit — worth flagging to a reader, and #609 extends that idiom to two new objects (session regions and SHM attachment regions) that were previously freed. - "Code Review Standards → Supported matrix & compatibility: Check interactions across every supported model, cache scheme, parallel layout, multi-host setup, and hardware target named in the docs." The PR claims SM120/SM121 + multi-host TP; the Windows path is explicitly unverified and SM121 is mentioned in the benefit sentence but the named hardware runs are SM120 (cn5) and GB10 (cn6–cn9). GB10 is SM121, so that is covered by the multi-host runs.
- "No per-model special cases or flags" — satisfied: no flags, no model branches, no wire protocol change (selene.proto untouched; verified no proto in the file list).
- "Be explicit and pin everything" — no dependency changes (selene/Cargo.toml untouched; ibverbs-sys 0.3.2 and io-uring 0.7 unchanged). Does not strain the non-goals: no new hardware support, no new backends, no rack-scale feature. One mild process tension: the charter's PR-description standard asks for "why / what changed / claimed result / evidence backing it" — #609 has all four sections, and is more candid than most about limitations. Its weakness is that the evidence is shared with three sibling PRs rather than its own.
#11 [medium] Reach: who is affected, defaults, compatibility, docs
- Users affected: anyone running
flare runwith the Selene pool enabled (host prefix cache,selene-manager), i.e. single-host SHM pool and cross-host--roce-ringRDMA. Also anyone with thecodecfeature (default:sanaka/Cargo.toml:14 default = ["codec"]) via the compressor lifetime change, and Windows users via theReadAheadIOCP attach. - No wire protocol change (
selene.protonot in the file list), no on-disk record format change, no config/default change, no new CLI flags, no dependency change, no public API change (rdma::Device::openandStaging::regionarepub(crate)). - Behavioural change a caller can observe:
MemoryStore::closecan now return a NEW error, "host KV compression did not finish before close" (memory.rs:3113-3115), andCompositeStore::closenow returns the memory error where it previously returned only the disk error (disk.and(memory)at composite.rs:1626 returns the firstErr, evaluating both). So an operator can see a close fail where it previously "succeeded" (with the memory tier leaked unbeknownst). conn::shutdownnow marks the engine quarantined on the timeout path, so the pool status becomesPoolStatus::Disabled("a copy could not be drained; memory is quarantined")and memory is retained for process lifetime in a case that previously just returned an error. That is a deliberate memory-retention tradeoff at shutdown.- Docs: no docs are touched.
docs/prefix-cache-offload.mdexists and is updated by other PRs (#607) but not by this one. Nothing in the PR documents the new close error or the wider quarantine retention for operators. - Deployment: no new build requirement. Windows compilation of the new
#[cfg(windows)]block is the one unexercised build path (README/CI run selene tests on Windows in native-serving.yml:53-55, so a Windows build break here would surface in CI for other PRs, not this one).
#12 [medium] Technical detail worth keeping: why the field order and the Arc matter
Field order = Drop order in Rust. MemoryStore previously declared core: Core before transfers: SharedCopier (now memory.rs:2240-2245 reverses that). Core owns the SlabPool; dropping the pool unmaps the pinned slab memory. SharedCopier is Arc<Mutex<dyn PageCopier>> (copier.rs:104-105) and the CUDA copy thread may still DMA into those slabs. So before the change, dropping the store without a successful close() could unmap slabs while the copier thread still wrote them. Same reasoning in disk_store.rs:208-226 for pool: Option<SlabPool> vs transfers. This is a Drop-order fix with NO code change beyond reordering and a comment — nothing fails to compile if a future edit reorders them again, which is the fragile part.
Staging/Region: Region is a mapped arena/staging block (selene/src/pool/shm.rs:150-178, Regions{arena,staging}). rdma::Device registers it with ibv_reg_mr and must dereg (ibv_dereg_mr) before the mapping goes away. Previously Staging.region: Region + field order was the only guarantee, and Pair::drop mem::forgets its device Arc when close() fails (rdma.rs:103-110) — so a QP whose teardown failed kept the registration alive while the mapping could still be freed with Staging. Wrapping in Arc<Region> and having Device hold a clone (rdma.rs:31-37, 61) makes the mapping outlive any forgotten Device, independent of field order. This is the cleanest of the fixes.
Scatter: SliceLayout::check validates window_len == window_bytes(pages,row) and scatter_disjoint then writes only ranks[rank]'s page/row ranges via copy_nonoverlapping (slice.rs:214-248), so no &mut [u8] covering other ranks' bytes is ever formed; the manager hands it a raw *mut u8 from LocalRegions::ptr_mut. ptr_mut is safe to call and returns a raw pointer, so the only remaining guard against aliasing is the SAFETY comment at channel.rs:939-940 and the store's grant/fence protocol.
#14 [medium] Verified premise: manager runs one task per data connection, so overlapping &mut was reachable
Verification of the manager-side concurrency premise: each accepted data connection is spawned as its own task (handle.spawn(async move { serve(inner, stream).await }), selene-manager/src/data/channel.rs:435-447), and run/receive_windows/send_windows per transfer run inside that task (channel.rs:562-607). Hub::start is given one Arc<LocalRegions> (channel.rs:230, 1033) shared by all handlers, and Inner::regions is that Arc. Therefore two handlers for two rank windows of the same put can concurrently reach regions.bytes(...) on the same arena; before this change the second &mut [u8] over the same/overlapping bytes would be UB even though each handler wrote only its own rank's slices. That is the premise the PR states.
Scope of the fix: the receive-side ptr_mut+scatter_disjoint path only runs when entry.slicing is Some and !grant.packed (channel.rs:908) — i.e. multi-rank unpacked puts. The send side (3 call sites) and pool::pass::run move to bytes_read, i.e. read-only views shared between handlers.
Residual, still-unsafe: LocalRegions::bytes (&mut) remains in use at channel.rs:913 for the whole-window unpacked receive (None arm of the same match) — that path still forms a &mut [u8] over the window; it is single-writer per grant so it isn't the aliasing case, but it means bytes was not removed.
Note #612 (merged 40 min later) rejects multi-process (world >= 2) packed PutBegin/PinAck grants, which prunes part of this multi-rank surface (not the unpacked scatter #609 fixes).
#15 [medium] Reader checklist: unresolved CI, residual unsafe, lost test coverage, undocumented retention
Things a downstream decision-maker should check or know, gathered (no verdict):
- CI on head 304dd3a is reported failed by the orientation packet. Not reproducible from this vantage point. Relevant files' workflows:
.github/workflows/native-serving.yml(Linux selene tests :48-52, Windows selene tests :53-55, RDMAcargo checkjob :101-113) and.github/workflows/helios-lifecycle.yml:7-8(triggers on selene/** and selene-manager/**). If the failure is in the Windows selene job, it would bear directly on the one unverified#[cfg(windows)]change in disk.rs:2032-2035. - The
disk.and(memory)form (composite.rs:1626) evaluates both closes but returnsdisk's error preferentially; a reader wanting to know whether the memory error is lost should look there. Behaviour: both are always closed now, at most one error is reported. MemoryStore::close's new error path forgets the compressor and leaks the pool but still runstransfers.close()first, so the returned error means "copier drained, compressor did not" — an operator sees close fail without a leak of the copier.offload/tests.rs:659assertion relaxation removes a case (fail == Some(1), warm != 0) that previously asserted memory was not closed when disk close failed. Any future regression that reintroduces short-circuiting would now go unnoticed by that test — the test only checksvec![1,0]ordering.ptr_mutis a safe function returning a raw*mut u8(regions.rs:59-66): callers can obtain a writable pointer without anunsafeblock, and the only guard is the caller's SAFETY comment. Everything downstream of it isunsafe. This is the weakest-safety-of-boundary in the diff.- Nothing in the PR or the repo documents the widened quarantine retention (session regions + SHM attachment regions now retained for process lifetime in a timeout case); no docs/ change.
- The evidence block is shared verbatim across #609/#610/#611/#612 — one qualification run, cited four times, run before the rebase.
#17 [medium] At a glance: #609 metadata, size and shape for citation
PR #609 "fix(selene): preserve DMA, RDMA, and shared-region lifetimes across cancel, close, and scatter", author yatesdr (COLLABORATOR), Discord handle given as D-Rock in the body.
- Branch
fix/selene-dma-lifetime-safety→main. Base commit 5df8edd3 (the merge of #607). Head commit 304dd3a (304dd3aaa819f42e8f9324c2129357a3429dc379), which is also the single commit, subject "Fix Selene DMA lifetime, quarantine, and shared-region aliasing bugs" (commit e2522eb0 on main). - Opened 2026-11-29 17:08, merged 2026-11-29 17:27 (19 minutes), no labels, no reviews, no comments, CI failed on head per the orientation packet.
- Size +225/−71 across 15 files: selene/src 12 files +154/−48, selene-manager/src 3 files +71/−23. Largest hunks: selene/src/shared/slice.rs (+68/−2), selene-manager/src/regions.rs (+58/−8), selene/src/memory.rs (+33/−10), selene/src/pool/engine/tests.rs (+20), selene-manager/src/data/channel.rs (+12/−14), selene/src/pool/rdma.rs (+9/−13). Everything else is ≤4 lines.
- No
selene.proto, nodocs/, noCargo.toml/Cargo.lock, no test-fixture/crate outside selene and selene-manager. Only one test existing test modified (selene/src/offload/tests.rs), three tests added. - Test count claim: 541/541
--libwith--features codec; the three named new tests all exist (engine/tests.rs:1571, shared/slice.rs:446, selene-manager/src/regions.rs:132). - Required PR-description parts (charter: why / what changed / claimed result / evidence) are all present, plus an unusually candid "Material limitations" section.
#18 [medium] Project fit: verbatim charter lines to cite
From the project charter (read_charter), the lines that bear on #609, verbatim with their line numbers:
- line 9: "* Solve the right problem in the right place. Before writing code, figure out if the change actually helps users—and if this is the right layer for it. Look for the smallest footprint in shared code, or a way to solve it without new code at all. Good ideas in the wrong place will be declined, and we'll point you to where they belong (#404)."
- line 24 (Goals): "* Store prefix-cache checkpoints in host memory and share them across Flare instances via Selene." — the area #609 hardens.
- line 28 (Non-Goals): "Broad production coverage across arbitrary models, GPUs, or deployment setups, as well as rack-scale features like disaggregation." — #609 does not add any.
- line 42 (Code Review Standards, supported matrix): "Supported matrix & compatibility: Check interactions across every supported model, cache scheme, parallel layout, multi-host setup, and hardware target named in the docs. Check state and CUDA-graph transitions, and verify that existing data, artifacts, and exported cores still load."
- line 43: "No per-model special cases or flags: Keep shared runtime layers general rather than adding model-specific branches or flags." — satisfied (no flags/branches added).
- line 54 (Roadmap): "Engram & shared Engram tables (#267): A broader design, scoped as its own project." — no relation.
Also relevant, from "How We Work": "Bring real evidence. Performance PRs need benchmarks showing an actual speedup over
mainon a served workload (#210). Bug fixes need to address the root cause; don't just swallow, skip, or retry an unexplained error (#397)." and "Be explicit and pin everything. No magic defaults, and pin dependencies to exact versions or commits (#215)." — no dependency pinning was touched, so #215 is neutral here. Priority contributors named by the charter:@voipmonitor,@original-el8,@lukealonso— yatesdr (this PR's author) is not among them but is a COLLABORATOR and the dominant recent committer in selene/src and selene-manager/src.
#13 [low] Leads followed from the orientation packet, including ones found not relevant
- #607 (merged): stacked base, mutually referenced, companion. Relevant — recorded in the batch note.
- #497 (merged): owns the offload test #609 relaxes; last touched selene/src/disk.rs. Relevant.
- #611 (merged): edits the same pool files and the same
Agent::quarantine/conn::shutdowncode one commit later. Relevant. - #496 (merged): disk-fetch coalescing, references the same Regions/bytes paths; only mildly relevant (its Windows IOCP test report is the contrast for #609's unverified Windows change).
- #504 (merged): introduced AsyncCompressor, which #609 hardens. Relevant.
- #415, #413, #429, #142, #141, #168, #101, #524: earlier yatesdr Selene store work, same files; context only, no overlap with this diff's hunks.
- #380 (merged): owns the RDMA staging registration #609 re-plumbs. Relevant.
- #554 (open, DRAFT "engram: read row-cache misses from an Engram store host over RDMA READ"): touches selene/src/pool/rdma.rs per the packet. #609 changes
rdma::Device::open's signature to takeArc<Region>; #554 is a draft in a different area (Engram), so the risk is a textual conflict in rdma.rs only. Noted, not investigated further (draft). - #255 (open issue, host prefix cache capacity_rejected): different problem (eviction/capacity), not lifetimes. Not relevant.
- #477 (closed): an earlier compression-series PR by the same author that this lineage superseded via #504. Not relevant beyond lineage.
- Packet's "CI failed" lead: could not identify the failing workflow run from here; the relevant workflows are native-serving.yml and helios-lifecycle.yml. Recorded as unresolved.