Skip to content

x/tools/internal/gocommand: TestRmdirAfterGoList_Runner failures #73736

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
gopherbot opened this issue May 15, 2025 · 3 comments
Open

x/tools/internal/gocommand: TestRmdirAfterGoList_Runner failures #73736

gopherbot opened this issue May 15, 2025 · 3 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@gopherbot
Copy link
Contributor

#!watchflakes
default <- pkg == "golang.org/x/tools/internal/gocommand" && test == "TestRmdirAfterGoList_Runner"

Issue created automatically to collect these failures.

Example (log):

=== RUN   TestRmdirAfterGoList_Runner
    invoke_test.go:115: failed to remove temp dir: remove C:\b\s\w\ir\x\t\TestRmdirAfterGoList_Runner2474274036\001: The process cannot access the file because it is being used by another process.
    invoke_test.go:118: C:\b\s\w\ir\x\t\TestRmdirAfterGoList_Runner2474274036\001 d 001/ <nil>
--- FAIL: TestRmdirAfterGoList_Runner (0.55s)

watchflakes

@gopherbot
Copy link
Contributor Author

Found new dashboard test flakes for:

#!watchflakes
default <- pkg == "golang.org/x/tools/internal/gocommand" && test == "TestRmdirAfterGoList_Runner"
2025-05-15 19:23 x_tools-go1.24-windows-amd64-longtest tools@ec0dab2f release-branch.go1.24@431f75a0 x/tools/internal/gocommand.TestRmdirAfterGoList_Runner (log)
=== RUN   TestRmdirAfterGoList_Runner
    invoke_test.go:115: failed to remove temp dir: remove C:\b\s\w\ir\x\t\TestRmdirAfterGoList_Runner2474274036\001: The process cannot access the file because it is being used by another process.
    invoke_test.go:118: C:\b\s\w\ir\x\t\TestRmdirAfterGoList_Runner2474274036\001 d 001/ <nil>
--- FAIL: TestRmdirAfterGoList_Runner (0.55s)

watchflakes

@gopherbot gopherbot added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 15, 2025
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label May 15, 2025
@gopherbot gopherbot added this to the Unreleased milestone May 15, 2025
@adonovan
Copy link
Member

Well that was quick. The directory listing shows only the t.TempDir directory, ...\TestRmdirAfterGoList_RunnerXXX\001. That likely means that the directory itself, not some other file within it such as go.mod or p/X.go, could not be deleted (though it's possible there's a race between WalkDir and whatever asynchronous task is still running).

Looking within gocommand, the answer seems fairly obvious: the WaitDelay mechanism of exec.Command allows, under some circumstances, the Wait call to return before all the work is done. Assuming that occurs, then the go list child process may be running after Wait returns. Since it holds a reference to its working directory, this prevents its deletion on Windows.

As long as we're using WaitDelay, we can't assume the child process is done when Runner.RunRaw returns.

@gopherbot
Copy link
Contributor Author

Found new dashboard test flakes for:

#!watchflakes
default <- pkg == "golang.org/x/tools/internal/gocommand" && test == "TestRmdirAfterGoList_Runner"
2025-05-16 16:55 x_tools-go1.24-windows-386 tools@5c7400c9 release-branch.go1.24@431f75a0 x/tools/internal/gocommand.TestRmdirAfterGoList_Runner (log)
=== RUN   TestRmdirAfterGoList_Runner
    invoke_test.go:115: failed to remove temp dir: remove C:\b\s\w\ir\x\t\TestRmdirAfterGoList_Runner477305817\001: The process cannot access the file because it is being used by another process.
    invoke_test.go:118: C:\b\s\w\ir\x\t\TestRmdirAfterGoList_Runner477305817\001 d 001/ <nil>
--- FAIL: TestRmdirAfterGoList_Runner (0.45s)
2025-05-16 16:59 x_tools-go1.23-windows-386 tools@2263a61d release-branch.go1.23@f77084d1 x/tools/internal/gocommand.TestRmdirAfterGoList_Runner (log)
=== RUN   TestRmdirAfterGoList_Runner
    invoke_test.go:115: failed to remove temp dir: remove C:\b\s\w\ir\x\t\TestRmdirAfterGoList_Runner841516109\001: The process cannot access the file because it is being used by another process.
    invoke_test.go:118: C:\b\s\w\ir\x\t\TestRmdirAfterGoList_Runner841516109\001 d 001/ <nil>
--- FAIL: TestRmdirAfterGoList_Runner (0.26s)

watchflakes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
Status: No status
Development

No branches or pull requests

2 participants