Repository navigation
Fix flaky StateMachineAsync_CallstackStressWithVaryingDepths test. - #130337
Merged
Conversation
Remove the buffer count assert since its depending on how test executes and what threads it ends up hitting on the resume paths.
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @VSadov |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes flakiness in the AsyncProfilerTests.StateMachineAsync_CallstackStressWithVaryingDepths test by removing a non-deterministic assertion that depends on how async work is scheduled across threads, while keeping the core validation of emitted async callstack frame data intact.
Changes:
- Removed the “>= 3 buffer flushes” assertion based on
ForEachEventBufferPayloadfromStateMachineAsync_CallstackStressWithVaryingDepths. - Kept the existing assertions that validate marker callstacks are emitted and contain resolvable, non-empty frame data.
noahfalk
approved these changes
Jul 8, 2026
eiriktsarpalis
pushed a commit
that referenced
this pull request
Jul 15, 2026
…130337) ### Summary Removes a fragile buffer-flush-count assertion from StateMachineAsync_CallstackStressWithVaryingDepths that has been intermittently failing in CI. The rest of the test — which validates async callstack frame data across 100 randomly-varying recursion depths — is unchanged. ### Problem The test ended with: int bufferCount = 0; ForEachEventBufferPayload(events, _ => bufferCount++); AssertTrue(stream, bufferCount >= 3, $"Expected at least 3 buffer flushes, got {bufferCount}"); ForEachEventBufferPayload counts per-thread event-buffer payloads, so bufferCount is a function of both the total event volume and how the work happened to be distributed across threadpool threads. ### Fix Drop the buffer-flush-count assertion. It is: - Non-deterministic — depends on threadpool scheduling, not just the (seeded) workload. - Redundant — the buffer overflow / rent path is already exercised deterministically by StateMachineAsync max-depth stress test (Depth = byte.MaxValue, Iterations = 128), which overflows the per-thread buffer many times over. The test retains its actual purpose: it still asserts every marker callstack has valid, resolvable frame data and that at least one marker callstack is emitted per iteration. ### Risk Test-only change; no product code touched. No loss of meaningful coverage. Fixes: #129938 #129871
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Removes a fragile buffer-flush-count assertion from StateMachineAsync_CallstackStressWithVaryingDepths that has been intermittently failing in CI. The rest of the test — which validates async callstack frame data across 100 randomly-varying recursion depths — is unchanged.
Problem
The test ended with:
int bufferCount = 0;
ForEachEventBufferPayload(events, _ => bufferCount++);
AssertTrue(stream, bufferCount >= 3, $"Expected at least 3 buffer flushes, got {bufferCount}");
ForEachEventBufferPayload counts per-thread event-buffer payloads, so bufferCount is a function of both the total event volume and how the work happened to be distributed across threadpool threads.
Fix
Drop the buffer-flush-count assertion. It is:
The test retains its actual purpose: it still asserts every marker callstack has valid, resolvable frame data and that at least one marker callstack is emitted per iteration.
Risk
Test-only change; no product code touched. No loss of meaningful coverage.
Fixes:
#129938
#129871