Repository navigation
pkg/proc: Fix flaky test on Windows - #4292
Merged
Merged
Conversation
Member
|
This change makes the test fail on macos. |
typesanitizer
force-pushed
the
vg/fix-windows-flake
branch
from
March 20, 2026 21:00
4996911 to
0e8e8b7
Compare
Contributor
Author
|
@aarzilli, apologies, I missed testing on macOS. I've pushed a change with a fix. Can you take a second look? Is there a specific reason there are no GitHub Actions for macOS or Linux, only for Windows (that too for arm64 only)? |
Member
They are tested through TeamCity. |
aarzilli
reviewed
Mar 23, 2026
TestWaitFor was flaky on Windows. This seems to be linked to prefix-based matching, where the fixture process spawned by one test could be waited upon by another test. Adding a unique no-op argument to different invocations of the same fixture binary appears to fix the flakiness issue.
typesanitizer
force-pushed
the
vg/fix-windows-flake
branch
from
March 23, 2026 18:17
0e8e8b7 to
c174a4d
Compare
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 was flaky on Windows. This seems to be linked to
prefix-based matching, where the fixture process spawned by
one test could be waited upon by another test. Adding a
unique no-op argument to different invocations of the
same fixture binary appears to fix the flakiness issue.
As I understand it, this happens because of the following:
Per the docs of
WaitForSingleObject,Delve (via stdlib) calls
WaitForSingleObject.After the process reaches a signaled state, the test
which was waiting is unblocked and it proceeds.
The test executor can switch to the next test
after the test completes.
Concurrent with subsequent test execution, the OS takes
its own sweet time cleaning the process up from various places.
(This might be delayed if someone else is holding a handle
to the process. The Go stdlib closes it's own, I'm not 100%
sure if it's the only one owning the handle, or whether
the spawned debugger could still be holding it.)
Delve calls
CreateToolhelp32Snapshot. This can sometimesend up seeing the "not yet fully cleaned up" process.
Claude found this old mailing list thread with a similar issue.
https://microsoft.public.win32.programmer.kernel.narkive.com/k4zy5KXb/waitforsingleobject-and-process-termination
I'm 80% confident in the above explanation, but it's possible
that I missed something.
I've tested the fix by running the test with
-count=100on Windows.