Repository navigation
selene,selene-manager,helios: fix pool staging UAF, chain walk DoS, multi-process put corruption, and offload lifecycle bugs - #607
Merged
Conversation
…ulti-process put corruption, and offload lifecycle bugs Why: Six memory-safety, remote-DoS, and state-corruption defects exist across `selene-manager`, `selene`, and `helios` in Selene pool transfers and prefix cache offload: 1. Remote data-channel staging UAF (`selene-manager/src/pool/claims.rs`): `Core::window_released` omitted the `claim.channel().is_some()` guard that `Core::window_filled` applies for `source_channel()`. A remote gRPC `WindowReleased` message cleared reader bit 0 and dropped `window.extent = None` while `selene-manager/src/data/channel.rs` (which holds no `Arc<Extent>`) was still reading `regions.bytes` or issuing RDMA writes from that staging slice, allowing use-after-free and cross-tenant KV leakage when the arena reallocated the extent. 2. Remote 100% CPU hang in `walk_chain` (`selene-manager/src/pool/mod.rs`, `selene-manager/src/pool/index.rs`): `entry_from` accepted self-parenting or non-monotonic parent keys (`parent.consumed_tokens >= key.consumed_tokens`), and `walk_chain` skipped `nodes.push` when `parent.tail_pages == 0`, so `nodes.len() >= max_nodes` never triggered on zero-page cycles or long zero-page chains. A single self-parenting notice could freeze `selene-manager` at 100% CPU. 3. Staging slot aliasing UB and premature peer window release (`selene/src/pool/agent.rs`, `selene/src/pool/engine/requester.rs`): When `channel.send(...)` returned `false` in `Agent::window_drained`, the agent released the staging slot without removing the window from `run.windows`, causing `Agent::drive` to release the same slot a second time into `Staging::free` (allowing concurrent `&mut [u8]` aliasing). In `Engine::withdraw_queued`, rank 0 released windows as soon as `w.jobs_left == 0` without checking `w.peers_left.is_empty()`, emitting `WindowReleased` while a shared-memory peer rank still had in-flight DMA. 4. Store transfer ID collision and broken linked multi-process puts (`selene-manager/src/pool/store_bridge.rs`, `selene-manager/src/pool/claims.rs`): `Core` passed raw client `put_id` and `claim_id` directly as `StoreCommand::*::transfer` into the store's single per-connection `ops` map, allowing concurrent puts and manager-backed claims with the same numeric client ID to collide or silently cross-cancel each other on `StoreCommand::Cancel`. Separately, `Core::put_answer` stored chain-absolute `grant.page_first` in `PutWin.first_page` instead of the record-relative offset used by `WindowSpec.first_page` and `put_commit`, so `put_pass_done` populated `mp.whole` starting at the parent's page count and `put_commit` failed every linked multi-process put with missing page checksums. 5. Stale pool plan on `Worker::park`, async CPU-codec refill pin leak, v3 disk quarantine gap, and expiry sweep hiding (#439) (`helios/src/server/runtime.rs`, `selene/src/memory.rs`, `selene/src/composite.rs`, `selene/src/shared/index.rs`): - `Worker::park` extended `incoming.prompt.tokens` and called `begin_pool_lookups` without clearing surviving pre-admission `pool_plan` / `pool_lookup`, causing `begin_pool_lookup` to keep or refresh the shorter pre-park `PrefixHistory`. - `MemoryStore::drain_compressed` guarded `start_deferred` with `if !refill`, stranding child checkpoints deferred during an async CPU-codec row refill and leaking their VRAM checkpoint pins. - `CompositeStore::disk_read` only quarantined corrupt disk records on the packed v4 path; unpacked v1/v2/v3 read errors hit `(Err(error), _)` without releasing the incomplete memory copy or quarantining damaged disk pages, causing repeated failing lookups on corrupt ancestors. - `Index::expired` used `take_while` over access-tick order and stopped at the first fresh leaf, so a leaf whose `last_used` was refreshed by `touch_ancestors` without advancing its access tick (issue #439) hid expired leaves behind it. What exactly changed: - `selene-manager/src/pool/claims.rs`: - Before: `Core::window_released` called `reader_done(key, m.index, 0)` even when the claim used a rank-0 data channel. - After: returns `Ok(())` immediately when `claim.channel().is_some()`, so only the data-channel handler's `Event::Sent` or `Event::Closed` releases bit 0 and the staging extent. - `selene-manager/src/pool/mod.rs` and `selene-manager/src/pool/index.rs`: - Before: `entry_from` did not compare `parent.consumed_tokens` against `key.consumed_tokens`, and `walk_chain` bounded only page-bearing nodes in `nodes.len()`. - After: `entry_from` rejects `parent.consumed_tokens == 0` or `parent.consumed_tokens >= key.consumed_tokens`; `walk_chain` returns `None` for `page_tokens == 0 || max_nodes == 0`, requires strictly decreasing non-zero `consumed_tokens` on every step, and counts every visited entry against `max_nodes`. - `selene/src/pool/agent.rs`, `selene/src/pool/net.rs`, and `selene/src/pool/engine/requester.rs`: - Before: `Agent::window_drained` released `slot` on `!sent` while leaving the window in `run.windows`, and `Engine::withdraw_queued` released windows on `w.jobs_left == 0` alone. - After: `Agent::window_drained` calls `self.forget_window(xfer, index)` after `self.release_slot(slot)` on `!sent`; `Staging::release` adds a `debug_assert!` rejecting duplicate slot release; `Engine::withdraw_queued` requires `w.jobs_left == 0 && w.peers_left.is_empty() && !w.released`. - `selene-manager/src/pool/{store_bridge,core,claims}.rs`: - Before: `StoreCommand` requests used raw client `put_id` / `claim_id` as `transfer`, and `PutWin.first_page` stored `grant.page_first as u32`. - After: `StoreHandle::next_transfer` allocates monotonic manager-side transfer IDs stored on `PutRec::transfer` and `ManagerGet::transfer` for all `StoreCommand` calls (`PutBegin`, `GetBegin`, `WindowFilled`, `PutCommit`, `RequestWindow`, `Cancel`), and `Core::put_answer` computes record-relative `first_page` once (`grant.page_first as u32 - accepted.1` when `page_count > 0`, else `0`) for both `PutWin` and `WindowSpec`. - `helios/src/server/runtime.rs`: - Before: `Worker::park` left `blocked`, `pool_lookup`, `pool_lookup_started`, `pool_plan`, and `restore_wait` intact before calling `begin_pool_lookups`. - After: clears all five fields before calling `begin_pool_lookups` on the extended prompt tokens. - `selene/src/memory.rs`: - Before: `MemoryStore::drain_compressed` skipped `start_deferred` when `rec.refill` was true. - After: calls `self.core.start_deferred(&key, events)` unconditionally after `apply_compressed`. - `selene/src/composite.rs`: - Before: `CompositeStore::disk_read` recorded `inbound.error` on `(Err(error), _)` without completing/discarding the memory allocation or quarantining the disk record. - After: releases the incomplete memory record via `complete_record(&node, false)`, resets the inbound node state to `NodeState::Waiting`, and calls `self.disk.quarantine_corrupt(&node)` when `error.is_record_read()`. - `selene/src/shared/index.rs` and `docs/prefix-cache-offload.md`: - Before: `Index::expired` stopped at the first fresh leaf via `take_while`. - After: filters `self.ordered()` for eligible expired leaves (`children == 0` and age `>= max_age`) without moving LRU ticks, and updates `docs/prefix-cache-offload.md` to match. Claimed benefit and result: - Observed in CPU unit tests: all 11 added regression tests verify each invariant directly on production entry points (data-channel extent retention across gRPC `WindowReleased`, rejection of self-parent/cyclic/oversized zero-page chains, single staging-slot release on failed channel send, peer-DMA gating in `withdraw_queued`, disjoint store transfer IDs for concurrent `put_id == claim_id`, successful linked multi-process put commit, fresh `PrefixHistory` planning after `Worker::park`, deferred child wakeup after async CPU-codec row refill, quarantine and repair of corrupt v3 disk ancestors, and expiry past leaves refreshed without a new access tick). - Expected in production serving: eliminates remote data-channel staging UAF and self-parenting CPU DoS in `selene-manager`, prevents staging slot aliasing and mid-DMA window release in multi-process `selene` clients, restores linked multi-process puts and concurrent put/get isolation in the manager store bridge, prevents stale pool prefix planning after parking in Helios, prevents VRAM pin leaks after async row refills, quarantines damaged v3 disk records, and resolves #439. No model core re-export or wire protocol change is required. Supporting evidence and limitations: - Targeted regression tests (all 11 passed, 0 failed): - `cargo test --locked --release --manifest-path selene/Cargo.toml --features test-support --target-dir flare-cli/target --lib -- failed_channel_send_releases_staging_slot_once withdraw_queued_waits_for_peer_dma_before_releasing_window async_cpu_codec_refill_wakes_deferred_child corrupt_ancestor_v3_page_is_quarantined_and_replaceable expired_sweep_skips_leaf_refreshed_without_new_tick` (5/5 passed). - `cargo test --locked --release --manifest-path selene-manager/Cargo.toml --features test-support --target-dir flare-cli/target --lib -- window_released_from_channel_requester_does_not_drop_extent entry_from_rejects_self_parent_and_non_monotonic_parent walk_chain_rejects_self_parent_cycles_and_zero_page_chains_beyond_max_nodes put_and_get_with_same_client_id_use_disjoint_store_transfers linked_multi_process_put_stores_record_relative_window_first_page` (5/5 passed). - `cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --target-dir flare-cli/target --lib -- worker_park_clears_stale_pool_plan_and_lookup` (1/1 passed). - Full crate and formal verification runs: - `cargo test --locked --release --manifest-path selene/Cargo.toml --features test-support --target-dir flare-cli/target`: 510 passed, 0 failed. - `cargo test --locked --release --manifest-path selene-manager/Cargo.toml --features test-support --target-dir flare-cli/target`: 185 `--lib` tests and all 11 integration test binaries (`builder`, `l0`, `offload`, `packed`, `pool_channel`, `pool_claims`, `pool_l0`, `pool_net`, `pool_relay`, `pool_store`, `rank_processes`) passed; `--test client` passed 84/85, with `a_record_put_into_a_manager_on_another_host_is_restored_over_tcp` exhibiting a pre-existing timing race against the 10 ms `Core::tick()` metrics refresh (`stream: 2 windows` when the second restore completes before the next tick; passed 1/5 isolated reruns). - `cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --target-dir flare-cli/target --lib -- server::runtime`: 133 passed, 0 failed, 1 ignored. - `python3 verification/helios-lifecycle/check.py --tlc-jar ~/.cache/flare-formal/tla2tools-1.7.4.jar --java ~/.cache/flare-formal/jdk-21.0.13+9-jre/bin/java --target-dir flare-cli/target`: exited 0 (all TLC models and observed-edge Rust conformance checks passed, including `ResponseLifecycle` and reasoning continuation). - Limitations and unrun checks: - `flare/Cargo.toml --locked` failed on an unrelated upstream lockfile mismatch for `deepseek-recipe` (`flare/` and `flare-cli/` were not modified). - `helios` chat-template tests requiring `FLARE_TEST_TEMPLATE_DIR` and live GPU/RDMA execution (`FLARE_RUN_CUDA_TESTS=1`) were not run. Signed-off-by: Luke Alonso <lalonso@gmail.com> Design-Signed-Off-By: Antigravity (Gemini); design-review=c3a9
Collaborator
|
A case file has been opened for 607. Future reviews will auto-run 90 minutes after code updates are pushed.
|
yatesdr
added a commit
to yatesdr/flare-local-inference
that referenced
this pull request
Nov 29, 2026
Active GPU DMA, host compression, NIC RDMA, and concurrent data-channel workers can access mapped host or shared-memory ranges across close, panic unwind, quarantine, and multi-rank scatter paths. Unmapping a region before every local copier, RDMA queue pair, and compression worker has drained causes use-after-unmap, and constructing overlapping `&mut [u8]` slices in `LocalRegions` is undefined behavior under concurrent readers or multi-rank writes. - Declare `transfers` before `core`/`pool` in `MemoryStore` and `disk_store::Resources`, close both tiers in `CompositeStore::close`, guard `AsyncCompressor`'s active count with an RAII drop guard, and leak the slab pool and report an error if compression does not finish before `MemoryStore::close` (`selene/src/memory.rs`, `selene/src/disk_store.rs`, `selene/src/composite.rs`). - Retain `sess.regions` and `Attachment::Shm` in `Engine::quarantine`, retain `self.shared` in `Agent::quarantine`, and invoke `engine.quarantine()` when `conn::shutdown` fails to drain (`selene/src/pool/engine/mod.rs`, `selene/src/pool/conn.rs`, `selene/src/pool/agent.rs`). - Wrap `Staging.region` in `Arc<Region>` and retain it inside `rdma::Device` so quarantined RDMA queue pairs keep their registered staging mapped (`selene/src/pool/rdma.rs`, `selene/src/pool/net.rs`). - Add `LocalRegions::bytes_read`, `LocalRegions::ptr_mut`, and `SliceLayout::scatter_disjoint` so concurrent read paths borrow `&[u8]` and multi-rank data-channel scatter writes only each rank's disjoint byte ranges without aliasing `&mut [u8]` (`selene/src/shared/slice.rs`, `selene-manager/src/regions.rs`, `selene-manager/src/pool/pass.rs`, `selene-manager/src/data/channel.rs`). - Attach `ReadAhead`'s overlapped file handle to its IOCP queue on Windows (`selene/src/disk.rs`). Every affected teardown, quarantine, RDMA, and concurrent region access path now preserves backing mappings and disjoint ownership until all DMA, RDMA, and worker accesses finish. Validated on Linux (rebased onto post-NVIDIA#607 main `5df8edd3c`), GB10, and SM120 hardware across `selene`, `selene-manager`, and `helios offload::`. Design-Signed-Off-By: derek <derek.yates@live.com>; design-review=2e5b
yatesdr
added a commit
to yatesdr/flare-local-inference
that referenced
this pull request
Nov 29, 2026
Local storage tiers, prepared-input caching, sharded disk ranks, direct
I/O loops, and KV-codec helpers had several correctness, durability, and
accounting bugs:
- Track `HashingState { in_flight, notice, rehash }` in `Announce::hashing`
so interleaved `Ready`/`Gone`/`Ready` transitions neither leak DRAM
pins nor announce stale hashes, and fast-path `allocate_slots(0, false)`
(`selene/src/memory.rs`).
- Refuse direct-to-disk writes under unwritten DRAM-parked ancestors in
`CompositeStore::store`, fix `Inbound::used_disk` NVMe attribution,
and remove the `waiting_spills` head-of-line cap
(`selene/src/composite.rs`).
- Require `!receive_profiles.is_empty()` for v4 packed files in
`DiskStore::new`, prevent self-eviction loops in `make_room_inner`,
fix `Reclaim::unlinked` `used` accounting after `Truncate`-then-`Unlink`,
and reject v4 empty `ranks` and replication flags in `Header::decode`
(`selene/src/disk_store.rs`, `selene/src/shared/record.rs`).
- Use an unbounded invalidation queue, generation epochs, `WaiterGuard`,
pre-eviction `retain()` checks, and accurate `len()` vs `capacity()`
in `InputStore` (`selene/src/input.rs`).
- Return `(drained, result)` from `Peer::shutdown`, return
`with_record_read()` on v4 mismatch and refuse rank-0 truncate fallback
on corrupt v4 files, prune page-only leaves in `shard::agree`, close
peers concurrently in `Sharded::close`, filter unreadable v4 files when
`KvCompression::Off`, propagate the global minimum disk limit across
3+ ranks, and canonicalize peer IPs (`selene/src/shard.rs`,
`selene/src/shard/tests.rs`, `selene/src/offload/sharded.rs`).
- Retry `EINTR` in `fallocate` and `io_uring`, retry block-aligned short
transfers, and make `Worker::publish` directory sync Windows-safe
(`selene/src/disk.rs`).
- Reject duplicate in-flight keys in `PooledStore::fetch`, start rate
tracking only after accepted paged fetches, prefer faster equal-length
local hits when a remote tier is degraded, guard `worth_transfer`
against NaN, use `RefCell::take` across Rayon in `GpuPlan::decode_checked_cpu`,
use checked arithmetic in `geometry.rs`, and reject unknown buffer
names in `codec_layout.rs` (`selene/src/pool/store.rs`,
`selene/src/levels.rs`, `selene/src/store.rs`,
`selene/src/shared/gpu_codec.rs`, `selene/src/geometry.rs`,
`selene/src/shared/codec_layout.rs`).
Local tiers, sharded disk ranks, prepared-input caches, and codec paths
no longer leak pins or disk accounting, desync disk limits across 3+
ranks, or panic on corrupt v4 headers.
Validated on Linux (rebased onto post-NVIDIA#607 main `5df8edd3c`), GB10, and
SM120 hardware across `selene`, `selene-manager`, and `helios offload::`.
Design-Signed-Off-By: derek <derek.yates@live.com>; design-review=2e5b
yatesdr
added a commit
to yatesdr/flare-local-inference
that referenced
this pull request
Nov 29, 2026
Several `selene-manager` paths accepted unvalidated peer metadata or multi-process packed operations that could cause out-of-bounds arena reads/writes, panics, or permanent slot and resource leaks. - Reject multi-process (`world >= 2`) packed `PutBegin` and `PinAck` grants cleanly instead of sizing an arena extent to compressed bytes and passing uncompressed window lengths to `pass::run` or concurrent rank writers (`selene-manager/src/pool/store_bridge.rs`, `selene-manager/src/pool/claims.rs`). - Cap scopes at 64 ranks and 1 TiB record sizes in `validate_scope`, replace panicking `next_power_of_two` calls with `checked_next_power_of_two`, check `PinAck` page and reservation bounds before allocating `PlannedWindow` vectors, and use checked arithmetic in `windows::plan` (`selene-manager/src/pool/mod.rs`, `selene-manager/src/store.rs`, `selene-manager/src/pool/claims.rs`, `selene-manager/src/pool/windows.rs`). - Reparent replaced nodes to root in `Index::reparent_to_root` when rootless fallback converts a linked replacement to a root record, and refuse evicting page-only ancestors with active readers in `evict_accounted` (`selene/src/shared/index.rs`, `selene-manager/src/store.rs`). - Reclaim terminal remote-channel `Pinned` exports on source disconnect, resolve rank-agent fences by `aid`, verify scope and rank secrets before keeping peer agents across rank-0 reconnect, bound and prune idle scopes, fall back to `kill(pid, 0)` when `pidfd_open` is unavailable, cap and time out TLS handshakes on `--listen`, and call `hub.shutdown()` before aborting `pool_task` (`selene-manager/src/pool/claims.rs`, `selene-manager/src/pool/ranks.rs`, `selene-manager/src/pool/core.rs`, `selene-manager/src/local.rs`, `selene-manager/src/control.rs`). The manager now rejects malformed or unsupported multi-process packed requests safely, resists oversize-geometry DoS inputs, keeps `Tree` topology consistent across rootless replacements, and reclaims remote export slots and shutdown resources cleanly. Validated on Linux (rebased onto post-NVIDIA#607 main `5df8edd3c`), GB10, and SM120 hardware across `selene` and `selene-manager`. Design-Signed-Off-By: derek <derek.yates@live.com>; design-review=2e5b
yatesdr
added a commit
to yatesdr/flare-local-inference
that referenced
this pull request
Nov 29, 2026
Local storage tiers, prepared-input caching, sharded disk ranks, direct
I/O loops, and KV-codec helpers had several correctness, durability, and
accounting bugs:
- Track `HashingState { in_flight, notice, rehash }` in `Announce::hashing`
so interleaved `Ready`/`Gone`/`Ready` transitions neither leak DRAM
pins nor announce stale hashes, and fast-path `allocate_slots(0, false)`
(`selene/src/memory.rs`).
- Refuse direct-to-disk writes under unwritten DRAM-parked ancestors in
`CompositeStore::store`, fix `Inbound::used_disk` NVMe attribution,
and remove the `waiting_spills` head-of-line cap
(`selene/src/composite.rs`).
- Require `!receive_profiles.is_empty()` for v4 packed files in
`DiskStore::new`, prevent self-eviction loops in `make_room_inner`,
fix `Reclaim::unlinked` `used` accounting after `Truncate`-then-`Unlink`,
and reject v4 empty `ranks` and replication flags in `Header::decode`
(`selene/src/disk_store.rs`, `selene/src/shared/record.rs`).
- Use an unbounded invalidation queue, generation epochs, `WaiterGuard`,
pre-eviction `retain()` checks, and accurate `len()` vs `capacity()`
in `InputStore` (`selene/src/input.rs`).
- Return `(drained, result)` from `Peer::shutdown`, return
`with_record_read()` on v4 mismatch and refuse rank-0 truncate fallback
on corrupt v4 files, prune page-only leaves in `shard::agree`, close
peers concurrently in `Sharded::close`, filter unreadable v4 files when
`KvCompression::Off`, propagate the global minimum disk limit across
3+ ranks, and canonicalize peer IPs (`selene/src/shard.rs`,
`selene/src/shard/tests.rs`, `selene/src/offload/sharded.rs`).
- Retry `EINTR` in `fallocate` and `io_uring`, retry block-aligned short
transfers, and make `Worker::publish` directory sync Windows-safe
(`selene/src/disk.rs`).
- Reject duplicate in-flight keys in `PooledStore::fetch`, start rate
tracking only after accepted paged fetches, prefer faster equal-length
local hits when a remote tier is degraded, guard `worth_transfer`
against NaN, use `RefCell::take` across Rayon in `GpuPlan::decode_checked_cpu`,
use checked arithmetic in `geometry.rs`, and reject unknown buffer
names in `codec_layout.rs` (`selene/src/pool/store.rs`,
`selene/src/levels.rs`, `selene/src/store.rs`,
`selene/src/shared/gpu_codec.rs`, `selene/src/geometry.rs`,
`selene/src/shared/codec_layout.rs`).
Local tiers, sharded disk ranks, prepared-input caches, and codec paths
no longer leak pins or disk accounting, desync disk limits across 3+
ranks, or panic on corrupt v4 headers.
Validated on Linux (rebased onto post-NVIDIA#607 main `5df8edd3c`), GB10, and
SM120 hardware across `selene`, `selene-manager`, and `helios offload::`.
Design-Signed-Off-By: yatesdr; design-review=2e5b
yatesdr
added a commit
to yatesdr/flare-local-inference
that referenced
this pull request
Nov 29, 2026
Active GPU DMA, host compression, NIC RDMA, and concurrent data-channel workers can access mapped host or shared-memory ranges across close, panic unwind, quarantine, and multi-rank scatter paths. Unmapping a region before every local copier, RDMA queue pair, and compression worker has drained causes use-after-unmap, and constructing overlapping `&mut [u8]` slices in `LocalRegions` is undefined behavior under concurrent readers or multi-rank writes. - Declare `transfers` before `core`/`pool` in `MemoryStore` and `disk_store::Resources`, close both tiers in `CompositeStore::close`, guard `AsyncCompressor`'s active count with an RAII drop guard, and leak the slab pool and report an error if compression does not finish before `MemoryStore::close` (`selene/src/memory.rs`, `selene/src/disk_store.rs`, `selene/src/composite.rs`). - Retain `sess.regions` and `Attachment::Shm` in `Engine::quarantine`, retain `self.shared` in `Agent::quarantine`, and invoke `engine.quarantine()` when `conn::shutdown` fails to drain (`selene/src/pool/engine/mod.rs`, `selene/src/pool/conn.rs`, `selene/src/pool/agent.rs`). - Wrap `Staging.region` in `Arc<Region>` and retain it inside `rdma::Device` so quarantined RDMA queue pairs keep their registered staging mapped (`selene/src/pool/rdma.rs`, `selene/src/pool/net.rs`). - Add `LocalRegions::bytes_read`, `LocalRegions::ptr_mut`, and `SliceLayout::scatter_disjoint` so concurrent read paths borrow `&[u8]` and multi-rank data-channel scatter writes only each rank's disjoint byte ranges without aliasing `&mut [u8]` (`selene/src/shared/slice.rs`, `selene-manager/src/regions.rs`, `selene-manager/src/pool/pass.rs`, `selene-manager/src/data/channel.rs`). - Attach `ReadAhead`'s overlapped file handle to its IOCP queue on Windows (`selene/src/disk.rs`). Every affected teardown, quarantine, RDMA, and concurrent region access path now preserves backing mappings and disjoint ownership until all DMA, RDMA, and worker accesses finish. Validated on Linux (rebased onto post-NVIDIA#607 main `5df8edd3c`), GB10, and SM120 hardware across `selene`, `selene-manager`, and `helios offload::`. Design-Signed-Off-By: yatesdr; design-review=2e5b
yatesdr
added a commit
to yatesdr/flare-local-inference
that referenced
this pull request
Nov 29, 2026
Several `selene-manager` paths accepted unvalidated peer metadata or multi-process packed operations that could cause out-of-bounds arena reads/writes, panics, or permanent slot and resource leaks. - Reject multi-process (`world >= 2`) packed `PutBegin` and `PinAck` grants cleanly instead of sizing an arena extent to compressed bytes and passing uncompressed window lengths to `pass::run` or concurrent rank writers (`selene-manager/src/pool/store_bridge.rs`, `selene-manager/src/pool/claims.rs`). - Cap scopes at 64 ranks and 1 TiB record sizes in `validate_scope`, replace panicking `next_power_of_two` calls with `checked_next_power_of_two`, check `PinAck` page and reservation bounds before allocating `PlannedWindow` vectors, and use checked arithmetic in `windows::plan` (`selene-manager/src/pool/mod.rs`, `selene-manager/src/store.rs`, `selene-manager/src/pool/claims.rs`, `selene-manager/src/pool/windows.rs`). - Reparent replaced nodes to root in `Index::reparent_to_root` when rootless fallback converts a linked replacement to a root record, and refuse evicting page-only ancestors with active readers in `evict_accounted` (`selene/src/shared/index.rs`, `selene-manager/src/store.rs`). - Reclaim terminal remote-channel `Pinned` exports on source disconnect, resolve rank-agent fences by `aid`, verify scope and rank secrets before keeping peer agents across rank-0 reconnect, bound and prune idle scopes, fall back to `kill(pid, 0)` when `pidfd_open` is unavailable, cap and time out TLS handshakes on `--listen`, and call `hub.shutdown()` before aborting `pool_task` (`selene-manager/src/pool/claims.rs`, `selene-manager/src/pool/ranks.rs`, `selene-manager/src/pool/core.rs`, `selene-manager/src/local.rs`, `selene-manager/src/control.rs`). The manager now rejects malformed or unsupported multi-process packed requests safely, resists oversize-geometry DoS inputs, keeps `Tree` topology consistent across rootless replacements, and reclaims remote export slots and shutdown resources cleanly. Validated on Linux (rebased onto post-NVIDIA#607 main `5df8edd3c`), GB10, and SM120 hardware across `selene` and `selene-manager`. Design-Signed-Off-By: yatesdr; design-review=2e5b
yatesdr
added a commit
to yatesdr/flare-local-inference
that referenced
this pull request
Nov 29, 2026
Several `selene-manager` paths accepted unvalidated peer metadata or multi-process packed operations that could cause out-of-bounds arena reads/writes, panics, or permanent slot and resource leaks. - Reject multi-process (`world >= 2`) packed `PutBegin` and `PinAck` grants cleanly instead of sizing an arena extent to compressed bytes and passing uncompressed window lengths to `pass::run` or concurrent rank writers (`selene-manager/src/pool/store_bridge.rs`, `selene-manager/src/pool/claims.rs`). - Cap scopes at 64 ranks and 1 TiB record sizes in `validate_scope`, replace panicking `next_power_of_two` calls with `checked_next_power_of_two`, check `PinAck` page and reservation bounds before allocating `PlannedWindow` vectors, and use checked arithmetic in `windows::plan` (`selene-manager/src/pool/mod.rs`, `selene-manager/src/store.rs`, `selene-manager/src/pool/claims.rs`, `selene-manager/src/pool/windows.rs`). - Reparent replaced nodes to root in `Index::reparent_to_root` when rootless fallback converts a linked replacement to a root record, and refuse evicting page-only ancestors with active readers in `evict_accounted` (`selene/src/shared/index.rs`, `selene-manager/src/store.rs`). - Reclaim terminal remote-channel `Pinned` exports on source disconnect, resolve rank-agent fences by `aid`, verify scope and rank secrets before keeping peer agents across rank-0 reconnect, bound and prune idle scopes, fall back to `kill(pid, 0)` when `pidfd_open` is unavailable, cap and time out TLS handshakes on `--listen`, and call `hub.shutdown()` before aborting `pool_task` (`selene-manager/src/pool/claims.rs`, `selene-manager/src/pool/ranks.rs`, `selene-manager/src/pool/core.rs`, `selene-manager/src/local.rs`, `selene-manager/src/control.rs`). The manager now rejects malformed or unsupported multi-process packed requests safely, resists oversize-geometry DoS inputs, keeps `Tree` topology consistent across rootless replacements, and reclaims remote export slots and shutdown resources cleanly. Validated on Linux (rebased onto post-NVIDIA#607 main `5df8edd3c`), GB10, and SM120 hardware across `selene` and `selene-manager`. Signed-off-by: yatesdr <6937857+yatesdr@users.noreply.github.com> Design-Signed-Off-By: yatesdr; design-review=2e5b
yatesdr
added a commit
to yatesdr/flare-local-inference
that referenced
this pull request
Nov 29, 2026
Local storage tiers, prepared-input caching, sharded disk ranks, direct
I/O loops, and KV-codec helpers had several correctness, durability, and
accounting bugs:
- Track `HashingState { in_flight, notice, rehash }` in `Announce::hashing`
so interleaved `Ready`/`Gone`/`Ready` transitions neither leak DRAM
pins nor announce stale hashes, and fast-path `allocate_slots(0, false)`
(`selene/src/memory.rs`).
- Refuse direct-to-disk writes under unwritten DRAM-parked ancestors in
`CompositeStore::store`, fix `Inbound::used_disk` NVMe attribution,
and remove the `waiting_spills` head-of-line cap
(`selene/src/composite.rs`).
- Require `!receive_profiles.is_empty()` for v4 packed files in
`DiskStore::new`, prevent self-eviction loops in `make_room_inner`,
fix `Reclaim::unlinked` `used` accounting after `Truncate`-then-`Unlink`,
and reject v4 empty `ranks` and replication flags in `Header::decode`
(`selene/src/disk_store.rs`, `selene/src/shared/record.rs`).
- Use an unbounded invalidation queue, generation epochs, `WaiterGuard`,
pre-eviction `retain()` checks, and accurate `len()` vs `capacity()`
in `InputStore` (`selene/src/input.rs`).
- Return `(drained, result)` from `Peer::shutdown`, return
`with_record_read()` on v4 mismatch and refuse rank-0 truncate fallback
on corrupt v4 files, prune page-only leaves in `shard::agree`, close
peers concurrently in `Sharded::close`, filter unreadable v4 files when
`KvCompression::Off`, propagate the global minimum disk limit across
3+ ranks, and canonicalize peer IPs (`selene/src/shard.rs`,
`selene/src/shard/tests.rs`, `selene/src/offload/sharded.rs`).
- Retry `EINTR` in `fallocate` and `io_uring`, retry block-aligned short
transfers, and make `Worker::publish` directory sync Windows-safe
(`selene/src/disk.rs`).
- Reject duplicate in-flight keys in `PooledStore::fetch`, start rate
tracking only after accepted paged fetches, prefer faster equal-length
local hits when a remote tier is degraded, guard `worth_transfer`
against NaN, use `RefCell::take` across Rayon in `GpuPlan::decode_checked_cpu`,
use checked arithmetic in `geometry.rs`, and reject unknown buffer
names in `codec_layout.rs` (`selene/src/pool/store.rs`,
`selene/src/levels.rs`, `selene/src/store.rs`,
`selene/src/shared/gpu_codec.rs`, `selene/src/geometry.rs`,
`selene/src/shared/codec_layout.rs`).
Local tiers, sharded disk ranks, prepared-input caches, and codec paths
no longer leak pins or disk accounting, desync disk limits across 3+
ranks, or panic on corrupt v4 headers.
Validated on Linux (rebased onto post-NVIDIA#607 main `5df8edd3c`), GB10, and
SM120 hardware across `selene`, `selene-manager`, and `helios offload::`.
Signed-off-by: yatesdr <6937857+yatesdr@users.noreply.github.com>
Design-Signed-Off-By: yatesdr; design-review=2e5b
yatesdr
added a commit
to yatesdr/flare-local-inference
that referenced
this pull request
Nov 29, 2026
Active GPU DMA, host compression, NIC RDMA, and concurrent data-channel workers can access mapped host or shared-memory ranges across close, panic unwind, quarantine, and multi-rank scatter paths. Unmapping a region before every local copier, RDMA queue pair, and compression worker has drained causes use-after-unmap, and constructing overlapping `&mut [u8]` slices in `LocalRegions` is undefined behavior under concurrent readers or multi-rank writes. - Declare `transfers` before `core`/`pool` in `MemoryStore` and `disk_store::Resources`, close both tiers in `CompositeStore::close`, guard `AsyncCompressor`'s active count with an RAII drop guard, and leak the slab pool and report an error if compression does not finish before `MemoryStore::close` (`selene/src/memory.rs`, `selene/src/disk_store.rs`, `selene/src/composite.rs`). - Retain `sess.regions` and `Attachment::Shm` in `Engine::quarantine`, retain `self.shared` in `Agent::quarantine`, and invoke `engine.quarantine()` when `conn::shutdown` fails to drain (`selene/src/pool/engine/mod.rs`, `selene/src/pool/conn.rs`, `selene/src/pool/agent.rs`). - Wrap `Staging.region` in `Arc<Region>` and retain it inside `rdma::Device` so quarantined RDMA queue pairs keep their registered staging mapped (`selene/src/pool/rdma.rs`, `selene/src/pool/net.rs`). - Add `LocalRegions::bytes_read`, `LocalRegions::ptr_mut`, and `SliceLayout::scatter_disjoint` so concurrent read paths borrow `&[u8]` and multi-rank data-channel scatter writes only each rank's disjoint byte ranges without aliasing `&mut [u8]` (`selene/src/shared/slice.rs`, `selene-manager/src/regions.rs`, `selene-manager/src/pool/pass.rs`, `selene-manager/src/data/channel.rs`). - Attach `ReadAhead`'s overlapped file handle to its IOCP queue on Windows (`selene/src/disk.rs`). Every affected teardown, quarantine, RDMA, and concurrent region access path now preserves backing mappings and disjoint ownership until all DMA, RDMA, and worker accesses finish. Validated on Linux (rebased onto post-NVIDIA#607 main `5df8edd3c`), GB10, and SM120 hardware across `selene`, `selene-manager`, and `helios offload::`. Signed-off-by: yatesdr <6937857+yatesdr@users.noreply.github.com> Design-Signed-Off-By: yatesdr; design-review=2e5b
yatesdr
added a commit
that referenced
this pull request
Nov 29, 2026
…609) Active GPU DMA, host compression, NIC RDMA, and concurrent data-channel workers can access mapped host or shared-memory ranges across close, panic unwind, quarantine, and multi-rank scatter paths. Unmapping a region before every local copier, RDMA queue pair, and compression worker has drained causes use-after-unmap, and constructing overlapping `&mut [u8]` slices in `LocalRegions` is undefined behavior under concurrent readers or multi-rank writes. - Declare `transfers` before `core`/`pool` in `MemoryStore` and `disk_store::Resources`, close both tiers in `CompositeStore::close`, guard `AsyncCompressor`'s active count with an RAII drop guard, and leak the slab pool and report an error if compression does not finish before `MemoryStore::close` (`selene/src/memory.rs`, `selene/src/disk_store.rs`, `selene/src/composite.rs`). - Retain `sess.regions` and `Attachment::Shm` in `Engine::quarantine`, retain `self.shared` in `Agent::quarantine`, and invoke `engine.quarantine()` when `conn::shutdown` fails to drain (`selene/src/pool/engine/mod.rs`, `selene/src/pool/conn.rs`, `selene/src/pool/agent.rs`). - Wrap `Staging.region` in `Arc<Region>` and retain it inside `rdma::Device` so quarantined RDMA queue pairs keep their registered staging mapped (`selene/src/pool/rdma.rs`, `selene/src/pool/net.rs`). - Add `LocalRegions::bytes_read`, `LocalRegions::ptr_mut`, and `SliceLayout::scatter_disjoint` so concurrent read paths borrow `&[u8]` and multi-rank data-channel scatter writes only each rank's disjoint byte ranges without aliasing `&mut [u8]` (`selene/src/shared/slice.rs`, `selene-manager/src/regions.rs`, `selene-manager/src/pool/pass.rs`, `selene-manager/src/data/channel.rs`). - Attach `ReadAhead`'s overlapped file handle to its IOCP queue on Windows (`selene/src/disk.rs`). Every affected teardown, quarantine, RDMA, and concurrent region access path now preserves backing mappings and disjoint ownership until all DMA, RDMA, and worker accesses finish. Validated on Linux (rebased onto post-#607 main `5df8edd3c`), GB10, and SM120 hardware across `selene`, `selene-manager`, and `helios offload::`. Design-Signed-Off-By: yatesdr; design-review=2e5b Signed-off-by: yatesdr <6937857+yatesdr@users.noreply.github.com> Co-authored-by: yatesdr <6937857+yatesdr@users.noreply.github.com>
yatesdr
added a commit
that referenced
this pull request
Nov 29, 2026
…610) Local storage tiers, prepared-input caching, sharded disk ranks, direct I/O loops, and KV-codec helpers had several correctness, durability, and accounting bugs: - Track `HashingState { in_flight, notice, rehash }` in `Announce::hashing` so interleaved `Ready`/`Gone`/`Ready` transitions neither leak DRAM pins nor announce stale hashes, and fast-path `allocate_slots(0, false)` (`selene/src/memory.rs`). - Refuse direct-to-disk writes under unwritten DRAM-parked ancestors in `CompositeStore::store`, fix `Inbound::used_disk` NVMe attribution, and remove the `waiting_spills` head-of-line cap (`selene/src/composite.rs`). - Require `!receive_profiles.is_empty()` for v4 packed files in `DiskStore::new`, prevent self-eviction loops in `make_room_inner`, fix `Reclaim::unlinked` `used` accounting after `Truncate`-then-`Unlink`, and reject v4 empty `ranks` and replication flags in `Header::decode` (`selene/src/disk_store.rs`, `selene/src/shared/record.rs`). - Use an unbounded invalidation queue, generation epochs, `WaiterGuard`, pre-eviction `retain()` checks, and accurate `len()` vs `capacity()` in `InputStore` (`selene/src/input.rs`). - Return `(drained, result)` from `Peer::shutdown`, return `with_record_read()` on v4 mismatch and refuse rank-0 truncate fallback on corrupt v4 files, prune page-only leaves in `shard::agree`, close peers concurrently in `Sharded::close`, filter unreadable v4 files when `KvCompression::Off`, propagate the global minimum disk limit across 3+ ranks, and canonicalize peer IPs (`selene/src/shard.rs`, `selene/src/shard/tests.rs`, `selene/src/offload/sharded.rs`). - Retry `EINTR` in `fallocate` and `io_uring`, retry block-aligned short transfers, and make `Worker::publish` directory sync Windows-safe (`selene/src/disk.rs`). - Reject duplicate in-flight keys in `PooledStore::fetch`, start rate tracking only after accepted paged fetches, prefer faster equal-length local hits when a remote tier is degraded, guard `worth_transfer` against NaN, use `RefCell::take` across Rayon in `GpuPlan::decode_checked_cpu`, use checked arithmetic in `geometry.rs`, and reject unknown buffer names in `codec_layout.rs` (`selene/src/pool/store.rs`, `selene/src/levels.rs`, `selene/src/store.rs`, `selene/src/shared/gpu_codec.rs`, `selene/src/geometry.rs`, `selene/src/shared/codec_layout.rs`). Local tiers, sharded disk ranks, prepared-input caches, and codec paths no longer leak pins or disk accounting, desync disk limits across 3+ ranks, or panic on corrupt v4 headers. Validated on Linux (rebased onto post-#607 main `5df8edd3c`), GB10, and SM120 hardware across `selene`, `selene-manager`, and `helios offload::`. Design-Signed-Off-By: yatesdr; design-review=2e5b Signed-off-by: yatesdr <6937857+yatesdr@users.noreply.github.com> Co-authored-by: yatesdr <6937857+yatesdr@users.noreply.github.com>
yatesdr
added a commit
to yatesdr/flare-local-inference
that referenced
this pull request
Nov 29, 2026
Several `selene-manager` paths accepted unvalidated peer metadata or multi-process packed operations that could cause out-of-bounds arena reads/writes, panics, or permanent slot and resource leaks. - Reject multi-process (`world >= 2`) packed `PutBegin` and `PinAck` grants cleanly instead of sizing an arena extent to compressed bytes and passing uncompressed window lengths to `pass::run` or concurrent rank writers (`selene-manager/src/pool/store_bridge.rs`, `selene-manager/src/pool/claims.rs`). - Cap scopes at 64 ranks and 1 TiB record sizes in `validate_scope`, replace panicking `next_power_of_two` calls with `checked_next_power_of_two`, check `PinAck` page and reservation bounds before allocating `PlannedWindow` vectors, and use checked arithmetic in `windows::plan` (`selene-manager/src/pool/mod.rs`, `selene-manager/src/store.rs`, `selene-manager/src/pool/claims.rs`, `selene-manager/src/pool/windows.rs`). - Reparent replaced nodes to root in `Index::reparent_to_root` when rootless fallback converts a linked replacement to a root record, and refuse evicting page-only ancestors with active readers in `evict_accounted` (`selene/src/shared/index.rs`, `selene-manager/src/store.rs`). - Reclaim terminal remote-channel `Pinned` exports on source disconnect, resolve rank-agent fences by `aid`, verify scope and rank secrets before keeping peer agents across rank-0 reconnect, bound and prune idle scopes, fall back to `kill(pid, 0)` when `pidfd_open` is unavailable, cap and time out TLS handshakes on `--listen`, and call `hub.shutdown()` before aborting `pool_task` (`selene-manager/src/pool/claims.rs`, `selene-manager/src/pool/ranks.rs`, `selene-manager/src/pool/core.rs`, `selene-manager/src/local.rs`, `selene-manager/src/control.rs`). The manager now rejects malformed or unsupported multi-process packed requests safely, resists oversize-geometry DoS inputs, keeps `Tree` topology consistent across rootless replacements, and reclaims remote export slots and shutdown resources cleanly. Validated on Linux (rebased onto post-NVIDIA#607 main `5df8edd3c`), GB10, and SM120 hardware across `selene` and `selene-manager`. Signed-off-by: yatesdr <6937857+yatesdr@users.noreply.github.com> Design-Signed-Off-By: yatesdr; design-review=2e5b
yatesdr
added a commit
that referenced
this pull request
Nov 29, 2026
…612) Several `selene-manager` paths accepted unvalidated peer metadata or multi-process packed operations that could cause out-of-bounds arena reads/writes, panics, or permanent slot and resource leaks. - Reject multi-process (`world >= 2`) packed `PutBegin` and `PinAck` grants cleanly instead of sizing an arena extent to compressed bytes and passing uncompressed window lengths to `pass::run` or concurrent rank writers (`selene-manager/src/pool/store_bridge.rs`, `selene-manager/src/pool/claims.rs`). - Cap scopes at 64 ranks and 1 TiB record sizes in `validate_scope`, replace panicking `next_power_of_two` calls with `checked_next_power_of_two`, check `PinAck` page and reservation bounds before allocating `PlannedWindow` vectors, and use checked arithmetic in `windows::plan` (`selene-manager/src/pool/mod.rs`, `selene-manager/src/store.rs`, `selene-manager/src/pool/claims.rs`, `selene-manager/src/pool/windows.rs`). - Reparent replaced nodes to root in `Index::reparent_to_root` when rootless fallback converts a linked replacement to a root record, and refuse evicting page-only ancestors with active readers in `evict_accounted` (`selene/src/shared/index.rs`, `selene-manager/src/store.rs`). - Reclaim terminal remote-channel `Pinned` exports on source disconnect, resolve rank-agent fences by `aid`, verify scope and rank secrets before keeping peer agents across rank-0 reconnect, bound and prune idle scopes, fall back to `kill(pid, 0)` when `pidfd_open` is unavailable, cap and time out TLS handshakes on `--listen`, and call `hub.shutdown()` before aborting `pool_task` (`selene-manager/src/pool/claims.rs`, `selene-manager/src/pool/ranks.rs`, `selene-manager/src/pool/core.rs`, `selene-manager/src/local.rs`, `selene-manager/src/control.rs`). The manager now rejects malformed or unsupported multi-process packed requests safely, resists oversize-geometry DoS inputs, keeps `Tree` topology consistent across rootless replacements, and reclaims remote export slots and shutdown resources cleanly. Validated on Linux (rebased onto post-#607 main `5df8edd3c`), GB10, and SM120 hardware across `selene` and `selene-manager`. Design-Signed-Off-By: yatesdr; design-review=2e5b Signed-off-by: yatesdr <6937857+yatesdr@users.noreply.github.com> Co-authored-by: yatesdr <6937857+yatesdr@users.noreply.github.com>
Collaborator
Autobot ReviewFull Review · Value Proposition · Case File Recommendation: Ready To MergePR #607 fixes six verified memory-safety, DoS, state-corruption, and offload lifecycle defects across
Walkthrough
Merge Risk: Low · up to
|
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
Six memory-safety, remote-DoS, and state-corruption defects affect Selene pool transfers and prefix cache offload across
selene-manager,selene, andhelios:selene-manager/src/pool/claims.rs):Core::window_releasedomitted theclaim.channel().is_some()guard thatCore::window_filledenforces forsource_channel(). A remote gRPCWindowReleasedcleared reader bit 0 and droppedwindow.extent = Nonewhileselene-manager/src/data/channel.rs(which holds noArc<Extent>) was still readingregions.bytesor issuing RDMA writes from that staging slice, permitting use-after-free and cross-tenant KV disclosure once the arena reallocated the extent.walk_chain(selene-manager/src/pool/mod.rs,selene-manager/src/pool/index.rs):entry_fromaccepted self-parenting or non-monotonic parent keys (parent.consumed_tokens >= key.consumed_tokens), andwalk_chainskippednodes.pushwhenparent.tail_pages == 0, sonodes.len() >= max_nodesnever triggered on zero-page cycles or long zero-page chains. A single self-parenting notice could freezeselene-managerat 100% CPU.selene/src/pool/agent.rs,selene/src/pool/engine/requester.rs): Whenchannel.send(...)returnedfalseinAgent::window_drained, the agent released the staging slot without removing the window fromrun.windows, causingAgent::driveto release the same slot a second time intoStaging::free(enabling concurrent&mut [u8]aliasing). InEngine::withdraw_queued, rank 0 released windows wheneverw.jobs_left == 0without checkingw.peers_left.is_empty(), emittingWindowReleasedwhile a shared-memory peer rank still had in-flight DMA.selene-manager/src/pool/store_bridge.rs,selene-manager/src/pool/claims.rs):Corepassed raw clientput_idandclaim_iddirectly asStoreCommand::*::transferinto the store's single per-connectionopsmap, allowing concurrent puts and manager-backed claims with the same numeric client ID to collide or silently cross-cancel each other onStoreCommand::Cancel. Separately,Core::put_answerstored chain-absolutegrant.page_firstinPutWin.first_pageinstead of the record-relative offset used byWindowSpec.first_pageandput_commit, soput_pass_donewrotemp.wholestarting at the parent's page count andput_commitfailed every linked multi-process put with missing page checksums.Worker::park, async CPU-codec refill pin leak, v3 disk quarantine gap, and expiry sweep hiding (Prefix-index sweep stops at a refreshed leaf whose access tick never advanced #439) (helios/src/server/runtime.rs,selene/src/memory.rs,selene/src/composite.rs,selene/src/shared/index.rs):Worker::parkextendedincoming.prompt.tokensand calledbegin_pool_lookupswithout clearing surviving pre-admissionpool_plan/pool_lookup, causingbegin_pool_lookupto retain or refresh the shorter pre-parkPrefixHistory.MemoryStore::drain_compressedguardedstart_deferredwithif !refill, stranding child checkpoints deferred while a parent underwent an async CPU-codec row refill and leaking their VRAM checkpoint pins.CompositeStore::disk_readonly quarantined corrupt disk records on the packed v4 path; unpacked v1/v2/v3 read errors hit(Err(error), _)without releasing the incomplete memory record or quarantining damaged disk pages, causing repeated failing lookups on corrupt ancestors.Index::expiredusedtake_whileover access-tick order and stopped at the first fresh leaf, so a leaf whoselast_usedwas refreshed bytouch_ancestorswithout advancing its access tick (Fixes Prefix-index sweep stops at a refreshed leaf whose access tick never advanced #439) hid expired leaves behind it.What exactly changed
selene-manager/src/pool/claims.rs:Core::window_releasedcalledreader_done(key, m.index, 0)regardless of whether the claim used a rank-0 data channel.Ok(())immediately whenclaim.channel().is_some(), so only the data-channel handler'sEvent::SentorEvent::Closedreleases reader bit 0 and the staging extent.selene-manager/src/pool/mod.rsandselene-manager/src/pool/index.rs:entry_fromdid not validateparent.consumed_tokensagainstkey.consumed_tokens, andwalk_chainchecked onlynodes.len() >= max_nodes(ignoring zero-page checkpoints).entry_fromrejectsparent.consumed_tokens == 0orparent.consumed_tokens >= key.consumed_tokens;walk_chainreturnsNoneforpage_tokens == 0 || max_nodes == 0, requires strictly decreasing non-zeroconsumed_tokenson every step, and bounds total visited entries (including zero-page checkpoints) bymax_nodes.selene/src/pool/agent.rs,selene/src/pool/net.rs, andselene/src/pool/engine/requester.rs:Agent::window_drainedcalledrelease_slot(slot)on!sentwithout removing the window fromrun.windows, andEngine::withdraw_queuedreleased windows onw.jobs_left == 0alone.Agent::window_drainedcallsself.forget_window(xfer, index)right afterself.release_slot(slot)on!sent;Staging::releaseadds adebug_assert!rejecting duplicate slot returns;Engine::withdraw_queuedrequiresw.jobs_left == 0 && w.peers_left.is_empty() && !w.released.selene-manager/src/pool/{store_bridge,core,claims}.rs:StoreCommandrequests used raw clientput_id/claim_idastransfer, andPutWin.first_pagestored chain-absolutegrant.page_first as u32.StoreHandle::next_transferallocates monotonic manager-side transfer IDs stored onPutRec::transferandManagerGet::transferfor allStoreCommandcalls (PutBegin,GetBegin,WindowFilled,PutCommit,RequestWindow,Cancel), andCore::put_answercomputes record-relativefirst_pageonce (grant.page_first as u32 - accepted.1whenpage_count > 0, else0) for bothPutWinandWindowSpec.helios/src/server/runtime.rs:Worker::parkleftblocked,pool_lookup,pool_lookup_started,pool_plan, andrestore_waitintact before callingbegin_pool_lookups.begin_pool_lookupson the extended prompt tokens.selene/src/memory.rs:MemoryStore::drain_compressedskippedstart_deferredwhenrec.refillwas true.self.core.start_deferred(&key, events)unconditionally afterapply_compressed.selene/src/composite.rs:CompositeStore::disk_readrecordedinbound.erroron(Err(error), _)without releasing the incomplete memory allocation or quarantining the disk record.complete_record(&node, false), resets the inbound node state toNodeState::Waiting, and callsself.disk.quarantine_corrupt(&node)whenerror.is_record_read().selene/src/shared/index.rsanddocs/prefix-cache-offload.md:Index::expiredstopped at the first fresh leaf viatake_while.self.ordered()for eligible expired leaves (children == 0and age>= max_age) without mutating LRU ticks, and updatesdocs/prefix-cache-offload.mdto match.Claimed benefit and result
WindowReleased, rejection of self-parent/cyclic/oversized zero-page chains, single staging-slot release on failed channel send, peer-DMA gating inwithdraw_queued, disjoint store transfer IDs for concurrentput_id == claim_id, successful linked multi-process put commit, freshPrefixHistoryplanning afterWorker::park, deferred child wakeup after async CPU-codec row refill, quarantine and replacement of corrupt v3 disk ancestors, and expiry past leaves refreshed without a new access tick.selene-manager, prevents staging slot aliasing and mid-DMA window release in multi-processseleneclients, restores linked multi-process puts and concurrent put/get isolation in the manager store bridge, prevents stale pool prefix planning after parking in Helios, prevents VRAM pin leaks after async row refills, quarantines damaged v3 disk records, and fixes Prefix-index sweep stops at a refreshed leaf whose access tick never advanced #439. No model core re-export or wire protocol change is required.Supporting evidence and limitations
cargo test --locked --release --manifest-path selene/Cargo.toml --features test-support --target-dir flare-cli/target --lib -- failed_channel_send_releases_staging_slot_once withdraw_queued_waits_for_peer_dma_before_releasing_window async_cpu_codec_refill_wakes_deferred_child corrupt_ancestor_v3_page_is_quarantined_and_replaceable expired_sweep_skips_leaf_refreshed_without_new_tick: 5 passed, 0 failed.cargo test --locked --release --manifest-path selene-manager/Cargo.toml --features test-support --target-dir flare-cli/target --lib -- window_released_from_channel_requester_does_not_drop_extent entry_from_rejects_self_parent_and_non_monotonic_parent walk_chain_rejects_self_parent_cycles_and_zero_page_chains_beyond_max_nodes put_and_get_with_same_client_id_use_disjoint_store_transfers linked_multi_process_put_stores_record_relative_window_first_page: 5 passed, 0 failed.cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --target-dir flare-cli/target --lib -- worker_park_clears_stale_pool_plan_and_lookup: 1 passed, 0 failed.cargo test --locked --release --manifest-path selene/Cargo.toml --features test-support --target-dir flare-cli/target: 510 passed, 0 failed.cargo test --locked --release --manifest-path selene-manager/Cargo.toml --features test-support --target-dir flare-cli/target: 185--libtests and all 11 integration test binaries (builder,l0,offload,packed,pool_channel,pool_claims,pool_l0,pool_net,pool_relay,pool_store,rank_processes) passed;--test clientpassed 84/85, witha_record_put_into_a_manager_on_another_host_is_restored_over_tcpshowing a pre-existing timing race against the 10 msCore::tick()metrics refresh (stream: 2 windowswhen the second restore completes before the next tick; passed 1/5 isolated reruns).cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --target-dir flare-cli/target --lib -- server::runtime: 133 passed, 0 failed, 1 ignored.python3 verification/helios-lifecycle/check.py --tlc-jar ~/.cache/flare-formal/tla2tools-1.7.4.jar --java ~/.cache/flare-formal/jdk-21.0.13+9-jre/bin/java --target-dir flare-cli/target: exited 0 (all TLC models and observed-edge Rust conformance checks passed, includingResponseLifecycleand reasoning continuation).flare/Cargo.toml --lockedfailed on an unrelated upstream lockfile mismatch fordeepseek-recipe(flare/andflare-cli/were not modified).helioschat-template tests requiringFLARE_TEST_TEMPLATE_DIRand live GPU/RDMA execution (FLARE_RUN_CUDA_TESTS=1) were not run.Discord: no username provided