Skip to content

fix: deflake //rs/p2p/state_sync_manager:state_sync_manager_integration_tests/test#9117

Closed
basvandijk wants to merge 1 commit intomasterfrom
ai/deflake-test-2026-03-02
Closed

fix: deflake //rs/p2p/state_sync_manager:state_sync_manager_integration_tests/test#9117
basvandijk wants to merge 1 commit intomasterfrom
ai/deflake-test-2026-03-02

Conversation

@basvandijk
Copy link
Copy Markdown
Collaborator

Root Cause

The test_full_subnet_mini_chunks test creates 40,000 tiny (1KB) chunks that must be synced across a simulated 13-node subnet with network latency (50ms + 30ms round-trip per hop). With 12 peers × 10 parallel downloads = 120 concurrent downloads and ~160ms round-trip per chunk, the theoretical minimum is ~53 seconds just for network latency, plus mutex contention, spawn_blocking overhead, and HTTP processing.

The successful CI runs took ~112 seconds (out of a 120-second timeout), meaning any CI machine pressure caused timeouts. All 13 flaky failures in the past week showed the same pattern: test_full_subnet_mini_chunks timing out at exactly 120 seconds.

Fix

Reduce the number of mini chunks from 40,000 to 10,000. With 10,000 chunks (still 40× more than test_full_subnet's 250 chunks), the test completes in ~22 seconds with negligible variance across 3 parallel runs, while still meaningfully testing the many-small-chunks code path.


This PR was created following the steps in .claude/skills/fix-flaky-tests/SKILL.md.

…on_tests/test

Reduce the number of mini chunks in test_full_subnet_mini_chunks from 40,000 to
10,000 to fix flaky timeouts.

Root cause: The test creates 40,000 tiny (1KB) chunks that must be synced across
a simulated 13-node subnet with network latency (50ms + 30ms round-trip per hop).
With 12 peers x 10 parallel downloads = 120 concurrent downloads and ~160ms
round-trip per chunk, the theoretical minimum is ~53 seconds just for network
latency, plus mutex contention, spawn_blocking overhead, and HTTP processing.
The successful CI runs took ~112 seconds (out of a 120-second timeout), meaning
any CI machine pressure caused timeouts.

With 10,000 chunks (still 40x more than test_full_subnet's 250 chunks), the test
completes in ~22 seconds with negligible variance, while still meaningfully
testing the many-small-chunks code path.
@github-actions github-actions Bot added the fix label Mar 2, 2026
@basvandijk
Copy link
Copy Markdown
Collaborator Author

Closed in favour of #9123.

@basvandijk basvandijk closed this Mar 4, 2026
@basvandijk basvandijk deleted the ai/deflake-test-2026-03-02 branch March 4, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant