Repository navigation
docs(design): tokio::spawn_blocking bridge for rayon CPU work in async daemon (#1751) - #3893
Merged
Merged
Conversation
…c daemon (#1751) Designs the bridge between the tokio-driven async daemon (#1934/#1935) and rayon-dispatched CPU work (checksums, delta apply, parallel stat). Recommends a `rayon_bridge` helper in `crates/transfer/src/async_compat.rs` using `tokio::task::spawn_blocking` with a threshold short-circuit, and discusses the dedicated-pool + `block_in_place` alternative plus risks (double-spawn, panic propagation, cancellation, oversubscription).
oferchen
added a commit
that referenced
this pull request
May 18, 2026
…c daemon (#1751) (#3893) Designs the bridge between the tokio-driven async daemon (#1934/#1935) and rayon-dispatched CPU work (checksums, delta apply, parallel stat). Recommends a `rayon_bridge` helper in `crates/transfer/src/async_compat.rs` using `tokio::task::spawn_blocking` with a threshold short-circuit, and discusses the dedicated-pool + `block_in_place` alternative plus risks (double-spawn, panic propagation, cancellation, oversubscription).
3 tasks
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
…c daemon (#1751) (#3893) Designs the bridge between the tokio-driven async daemon (#1934/#1935) and rayon-dispatched CPU work (checksums, delta apply, parallel stat). Recommends a `rayon_bridge` helper in `crates/transfer/src/async_compat.rs` using `tokio::task::spawn_blocking` with a threshold short-circuit, and discusses the dedicated-pool + `block_in_place` alternative plus risks (double-spawn, panic propagation, cancellation, oversubscription).
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
EDG-PANIC.1: workspace audit of bare slice indexing patterns on attacker-controlled buffers (protocol/transfer/checksums/compress). ~314 indexing sites reviewed; only the two known UTS-18 sites in BufferedMap surfaced as suspect, both with a fix in flight via PR #5566. All other indexing is bounds-checked on the prior line, backed by fixed-size [u8; N] arrays, min-clamped, or covered by a length-prefix or library contract. Findings written to docs/audits/edg-panic-1-bare-slice-indexing.md with follow-up items enumerated as future EDG-PANIC tasks. EDG-PANIC.3: pin the BufferedMap basis-slice bounds contract with five negative-bounds unit tests against map_ptr (the BufferedMap "slice" accessor): - offset past EOF returns Err - length overflow (usize::MAX) returns Err - u64::MAX offset returns Err - offset == file_size with non-zero len returns Err (offset == file_size with zero len is a legitimate empty slice) - range straddling EOF returns Err Each test asserts io::ErrorKind::UnexpectedEof so a future change that drops or weakens the saturating_add guard is caught at the test boundary. Mirrors the malformed delta stream attack surface UTS-18 root-caused (range end index N out of range for slice of length M aborting the process). Refs: #3891, #3893
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.
Summary
rayon_bridgehelper incrates/transfer/src/async_compat.rsthat wrapstokio::task::spawn_blockingwith a threshold short-circuit, mappingJoinErrorto upstream-compatible exit codes.ThreadPool+block_in_placealternative for worker-pool-aware avoidance of double-spawn cost, and enumerates risks (panic propagation, cancellation, oversubscription, blocking-pool exhaustion).Tracks #1751.
Test plan
crates/transfer/src/async_compat.rsis added in the implementation PR.crates/checksums/src/rolling/parallel.rs,crates/engine/src/delta/,crates/transfer/src/receiver/parallel.rs) still cover all rayon entry points reachable from async contexts.