Repository navigation
test(daemon): synthetic spawn-storm reproducer for #691 - #738
Merged
Merged
Conversation
Adds `crates/zccache/tests/daemon_spawn_storm_test.rs` so the #691 spawn-storm class becomes regression-testable without depending on a heavy parallel rustc workload on a runner. One test: - `parallel_wrappers_must_share_one_daemon` (#[ignore], integration): fires N=16 (tunable via ZCCACHE_SPAWN_STORM_N) parallel zccache wrapper invocations against a fresh ZCCACHE_CACHE_DIR, sync'd on a std::sync::Barrier so they race the daemon-spawn decision together. Asserts exactly one daemon-spawn-*.log lands in logs/ and exactly one event:"spawn" line lands in daemon-lifecycle.log. This is the invariant the coordination fix from #691 should establish. Gated on ZCCACHE_RUN_REPRO_691=1 in addition to #[ignore], so it is a no-op under both `cargo test` (unit) and `cargo test -- --ignored` (./test --integration). Opt in with: ZCCACHE_RUN_REPRO_691=1 ./test --integration -- daemon_spawn_storm On main today the test is expected to FAIL — multiple spawn-attempt events fire in the racing window before the post-spawn dedup (#640) catches them, and on loaded runners multiple spawn events can land. Once the spawn-coordination fix lands, drop the env-var gate so the test joins the standard integration suite as a permanent regression. Modeled on cli_single_daemon_per_session.rs (#323 regression test; same helpers, same log-inspection pattern) and on the synthetic daemon_burst_link_test.rs precedent from #729 / #733. Refs #691. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This was referenced Jun 14, 2026
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
crates/zccache/tests/daemon_spawn_storm_test.rsas a deterministic synthetic reproducer for the daemon: spawn-recovery loop fans out into process storm under parallel rustc load (43+ zombies from a single timed-out parent observed) #691 daemon spawn-storm class.#[ignore]+ double-gated onZCCACHE_RUN_REPRO_691=1so it is a no-op under bothcargo test(unit) andcargo test -- --ignored/./test --integrationuntil the coordination fix lands.Refs #691.
What the test does
parallel_wrappers_must_share_one_daemonfires N=16 (tunable viaZCCACHE_SPAWN_STORM_N)zccache <echo_shim>invocations against a single freshZCCACHE_CACHE_DIR, sync'd on astd::sync::Barrierso they race the daemon-spawn decision together. After all complete and the daemon is explicitly stopped, asserts:daemon-spawn-*.loglands inlogs/.event:\"spawn\"line lands indaemon-lifecycle.log.This is the invariant the coordination fix from #691 should establish (named-mutex on Windows /
flockon Unix gatingensure_daemon).Modeled on:
cli_single_daemon_per_session.rs(bug: multiple zccache-daemon processes spawn during one session — in-memory state fragmented #323 regression) — same helpers, same log-inspection pattern, parallel version.daemon_burst_link_test.rs(test: synthetic ninja burst-link reproducer for #726 daemon graceful-shutdown under high concurrent link #729 / test(daemon): synthetic burst-link reproducer for #726 (closes #729) #733) — synthetic-reproducer-as-separate-PR precedent for a daemon-side concurrency class.How to run
Expected outcome on main today: FAIL — multiple
spawn-attemptevents fire in the racing window before the post-spawn dedup (#640) catches them, and on loaded runners multiplespawnevents can land before sibling daemons probe and exit.Expected outcome after the spawn-coordination fix: PASS with one spawn and one spawn-attempt.
Once the fix lands, drop the
ZCCACHE_RUN_REPRO_691gate so the test joins the standard integration suite as a permanent regression test.Test plan
🤖 Generated with Claude Code