Repository navigation
pkg/proc: Fix flakiness in TestWaitFor - #4306
Merged
derekparker merged 1 commit intoApr 23, 2026
Merged
Conversation
aarzilli
reviewed
Apr 14, 2026
TestWaitFor could have the following sequence of events: 1. cmd.Start() is called. 2. The process is started in the kernel. 3. CreateToolhelp32Snapshot (inside waitForSearchProcess) sees the process and returns from native.WaitFor. 4. The test immediately deferences cmd.Process, but cmd.Process has not been assigned yet in cmd.Start() -> nil panic. This patch fixes the issue by introducing a channel that is written to from testWaitForSetup() _after_ cmd.Start() returns. Unlike the mutex + boolean, this channel can be waited upon without spinning, and only then cmd.Process is read inside the test code.
typesanitizer
force-pushed
the
vg/fix-windows-flake-2
branch
from
April 14, 2026 17:46
6ec1390 to
236ce9d
Compare
Contributor
Author
|
@aarzilli sorry, I don't have merge access, can you merge the PR for me? Is there something else you'd like me to do before merging? |
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.
TestWaitFor could have the following sequence of events:
the process and returns from native.WaitFor.
has not been assigned yet in cmd.Start() -> nil panic.
This patch fixes the issue by introducing a channel that is
written to from testWaitForSetup() after cmd.Start() returns.
Unlike the mutex + boolean, this channel can be waited upon
without spinning, and only then cmd.Process is read inside
the test code.