Synchronize redirected output snapshots - #359
Merged
Merged
Conversation
Take stdout and stderr snapshots under the same locks used by asynchronous output callbacks so StringBuilder cannot be read while it is being mutated. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
mthalman
marked this pull request as ready for review
August 5, 2026 14:35
nagilson
approved these changes
Aug 5, 2026
Member
|
@mthalman Approved but I don't have access to this repo nor permission to JIT to give myself permission. |
mthalman
enabled auto-merge (squash)
August 5, 2026 16:35
akoeplinger
approved these changes
Aug 6, 2026
Member
|
/backport to release/10.0 |
Member
|
/backport to release/10.0 |
Member
Author
|
@akoeplinger - There is no backport workflow in this repo |
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.
Failure
VMR Azure DevOps build 3039585 had two source-only validation failures:
SB_CentOSStream10_Offline_CurrentSourceBuiltSdk_Validation_x64SB_Alpine323_Offline_MsftSdk_Validation_x64In both legs,
VerifyWebAPITemplate(language: FSharp)threwSystem.ArgumentOutOfRangeExceptionwith parameterchunkLengthfromStringBuilder.ToString()whileExecuteHelperwas collecting redirected process output.Suspected cause
PR #354 changed the post-kill process waits in
ExecuteHelper.ExecuteProcess,DotNetSdkHelper.ExecuteRunWeb, andDotNetSdkHelper.ExecuteRunUIAppfrom an unboundedWaitForExit()to a 30-second bounded wait. That change prevents scenario-test hangs when a surviving descendant keeps redirected stdout/stderr handles open, but it also allows execution to continue before the asynchronous readers have reached EOF.The
OutputDataReceivedandErrorDataReceivedcallbacks append under locks, while the laterStringBuilder.ToString()snapshots were outside those locks. If a callback runs while a snapshot is being taken,StringBuildercan observe concurrent mutation and throw. Confidence: high.Fix
Take the stdout and stderr snapshots under the same existing locks used by their respective callbacks. This preserves the bounded wait while preventing concurrent reads and writes.