Skip to content

fix: 98% CPU on WSL2 ARM + 10 correctness fixes#32

Merged
alderpath merged 1 commit into
masterfrom
fix-arm-cpu
Jun 20, 2026
Merged

fix: 98% CPU on WSL2 ARM + 10 correctness fixes#32
alderpath merged 1 commit into
masterfrom
fix-arm-cpu

Conversation

@alderpath

Copy link
Copy Markdown
Contributor

Root Cause

Scavenger walks entire workdir tree (including .cargo/registry/ with 50K+ files) through WSL2's 9p filesystem (10-100x slower). 12-core Oryon oversubscription amplifies it — 24 tokio+rayon threads compete for 12 cores.

Fixes (6)

  1. Filter scavenger WalkDir — skip dep/cache dirs
  2. Muzzle scavenger by default — zero CPU until explicitly enabled
  3. Adaptive scavenger backoff — double sleep up to 30min if cycle >60s
  4. Skip heal on WSL2 drvfs — no cargo test subprocess on /mnt/ paths
  5. Cap tokio workers to 4 (was 12 on 12-core ARM)
  6. Cap rayon pool to 4 threads (was 12)

Correctness fixes (4)

  • e2e_auth_routing: strip RELIARY_UPSTREAM_URL from daemon spawn env
  • try_prefetch: wrap filesystem I/O in spawn_blocking inside SSE hot path
  • GUARD_CACHE: add 60s TTL eviction to bound memory growth
  • GATE_VERSION: align to workspace v0.6.5, remove false '6 mechanisms' claim

All 78 unit + 38 e2e tests pass.

Root cause: unmuzzled scavenger walks entire workdir tree (including
.cargo/registry/ with 50K+ files) through WSL2's 9p (10-100x slower).
12-core Oryon oversubscription (24 tokio+rayon threads) amplifies it.

Fixes (6):
1. Filter scavenger WalkDir — skip dep/cache dirs (.cargo, .npm, .cache, etc)
2. Muzzle scavenger by default (AtomicBool::new(true))
3. Adaptive scavenger backoff (double sleep up to 30min if cycle >60s)
4. Skip heal cargo test on WSL2 drvfs (/mnt/ paths)
5. Cap tokio worker threads to 4 (was 12 on 12-core ARM)
6. Cap rayon global pool to 4 threads (was 12)

Correctness fixes (4):
- e2e_auth_routing: strip RELIARY_UPSTREAM_URL from daemon spawn env
- try_prefetch: spawn_blocking for filesystem I/O in SSE hot path
- GUARD_CACHE: add 60s TTL eviction to bound memory growth
- GATE_VERSION: align to workspace version, remove false '6 mechanisms' claim

All 78 unit + 38 e2e tests pass.
@alderpath alderpath merged commit a0461df into master Jun 20, 2026
9 checks passed
alderpath added a commit that referenced this pull request Jun 22, 2026
fix: 98% CPU on WSL2 ARM + 10 correctness fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant