fix(server): stabilize flaky delete telemetry unit test - #2521
Merged
derekwaynecarr merged 1 commit intoJul 28, 2026
Merged
Conversation
Replace yield_now() spin-loop with sleep(10ms) polling in delete_handler_ends_telemetry_for_the_resolved_sandbox_id. The single-threaded tokio runtime starves the spawn_blocking threads used by SQLite when yield_now() burns 100% CPU waiting for the delete gate entry count. Increase the timeout from 1s to 5s for consistency with similar guard tests. Signed-off-by: Derek Carr <decarr@redhat.com>
derekwaynecarr
requested review from
a team,
maxamillion and
mrunalp
as code owners
July 28, 2026 15:45
Collaborator
Author
|
/ok to test c496a5b |
drew
approved these changes
Jul 28, 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
delete_handler_ends_telemetry_for_the_resolved_sandbox_idby replacingyield_now()spin-loop withsleep(10ms)polling and increasing the timeout from 1s to 5sRelated Issue
Pre-existing flake observed on
main— the test intermittently times out under CI load.Changes
The test holds the global
sandbox_sync_guardand spawns a delete handler, then polls fordelete_gate_entry_count()to become non-zero. The spawned task must complete two SQLite queries (viaspawn_blocking) before acquiring the delete gate. In the single-threaded#[tokio::test]runtime,yield_now()creates a CPU-bound spin-loop that starves the blocking thread pool, causing the 1-second timeout to expire on loaded CI machines.tokio::task::yield_now()withtokio::time::sleep(10ms)to release CPU between pollscreate_sandbox_with_providers_waits_for_sandbox_sync_guardtestTesting
mise run pre-commitpassesChecklist