Skip to content

x/tools/go/packages: TestRmdirAfterGoList failures #73481

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 Apr 23, 2025 · 7 comments
Open

x/tools/go/packages: TestRmdirAfterGoList failures #73481

gopherbot opened this issue Apr 23, 2025 · 7 comments
Assignees
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/go/packages" && test == "TestRmdirAfterGoList"

Issue created automatically to collect these failures.

Example (log):

=== RUN   TestRmdirAfterGoList
    packages_test.go:3456: failed to remove temp dir: remove C:\b\s\w\ir\x\t\TestRmdirAfterGoList2309417357\001: The process cannot access the file because it is being used by another process.
--- FAIL: TestRmdirAfterGoList (0.38s)

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 Apr 23, 2025
@gopherbot
Copy link
Contributor Author

Found new dashboard test flakes for:

#!watchflakes
default <- pkg == "golang.org/x/tools/go/packages" && test == "TestRmdirAfterGoList"
2025-04-23 18:11 x_tools-go1.23-windows-386 tools@f11abcb1 release-branch.go1.23@96537d50 x/tools/go/packages.TestRmdirAfterGoList (log)
=== RUN   TestRmdirAfterGoList
    packages_test.go:3456: failed to remove temp dir: remove C:\b\s\w\ir\x\t\TestRmdirAfterGoList2309417357\001: The process cannot access the file because it is being used by another process.
--- FAIL: TestRmdirAfterGoList (0.38s)
2025-04-23 18:11 x_tools-gotip-windows-386 tools@f11abcb1 go@71d95059 x/tools/go/packages.TestRmdirAfterGoList (log)
=== RUN   TestRmdirAfterGoList
    packages_test.go:3456: failed to remove temp dir: unlinkat C:\b\s\w\ir\x\t\TestRmdirAfterGoList3208208857\001: The process cannot access the file because it is being used by another process.
--- FAIL: TestRmdirAfterGoList (0.38s)

watchflakes

@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Apr 23, 2025
@gopherbot gopherbot added this to the Unreleased milestone Apr 23, 2025
@adonovan adonovan self-assigned this Apr 24, 2025
@gopherbot
Copy link
Contributor Author

Found new dashboard test flakes for:

#!watchflakes
default <- pkg == "golang.org/x/tools/go/packages" && test == "TestRmdirAfterGoList"
2025-04-23 19:01 x_tools-gotip-windows-386 tools@68e94bd1 go@fca58326 x/tools/go/packages.TestRmdirAfterGoList (log)
=== RUN   TestRmdirAfterGoList
    packages_test.go:3456: failed to remove temp dir: unlinkat C:\b\s\w\ir\x\t\TestRmdirAfterGoList1775369776\001: The process cannot access the file because it is being used by another process.
--- FAIL: TestRmdirAfterGoList (0.38s)
2025-04-24 02:15 x_tools-gotip-windows-amd64 tools@caf7cdc8 go@702f164e x/tools/go/packages.TestRmdirAfterGoList (log)
=== RUN   TestRmdirAfterGoList
    packages_test.go:3456: failed to remove temp dir: unlinkat C:\b\s\w\ir\x\t\TestRmdirAfterGoList2123702643\001: The process cannot access the file because it is being used by another process.
--- FAIL: TestRmdirAfterGoList (0.25s)
2025-04-24 02:15 x_tools-gotip-windows-amd64-race tools@caf7cdc8 go@702f164e x/tools/go/packages.TestRmdirAfterGoList (log)
=== RUN   TestRmdirAfterGoList
    packages_test.go:3456: failed to remove temp dir: unlinkat C:\b\s\w\ir\x\t\TestRmdirAfterGoList2080313818\001: The process cannot access the file because it is being used by another process.
--- FAIL: TestRmdirAfterGoList (0.22s)

watchflakes

@adonovan
Copy link
Member

The failure of this test indicates a bug in the go list command on Windows:

https://cs.opensource.google/go/x/tools/+/master:go/packages/packages_test.go;l=3406-3411;drc=cd183620b17f4a5ef1289bb0995c15cec62bc39f

// This is not a test of go/packages at all: it's a test of whether it
// is possible to delete the directory used by go list once it has
// finished. It is intended to evaluate the hypothesis (to explain
// issue #71544) that the go command, on Windows, occasionally fails
// to release all its handles to the temporary directory even when it
// should have finished. If this test ever fails, the go command has a bug.
func TestRmdirAfterGoList(t *testing.T) {

I wondered whether the telemetry child process was outliving the parent go list process and holding the directory open, but the child seems to set its working directory to the telemetry default directory beneath os.GetUserDir.

Any ideas @matloob @samthanawalla?

@adonovan
Copy link
Member

The failure of this test indicates a bug in the go list command on Windows:

Actually, this comment reflects the test as it was in the first patchset, but later changes mean that now we can conclude only that the combination of gocommand + go list has a bug.

CL 667857 adds back the original test as a control.

@gopherbot
Copy link
Contributor Author

Change https://go.dev/cl/667857 mentions this issue: go/packages: add variant of TestRmdirAfterGoList without gocommand

@gopherbot
Copy link
Contributor Author

Found new dashboard test flakes for:

#!watchflakes
default <- pkg == "golang.org/x/tools/go/packages" && test == "TestRmdirAfterGoList"
2025-04-24 02:15 x_tools-go1.24-windows-amd64 tools@d3a3775b release-branch.go1.24@a9d9b557 x/tools/go/packages.TestRmdirAfterGoList (log)
=== RUN   TestRmdirAfterGoList
    packages_test.go:3456: failed to remove temp dir: remove C:\b\s\w\ir\x\t\TestRmdirAfterGoList3411071353\001: The process cannot access the file because it is being used by another process.
--- FAIL: TestRmdirAfterGoList (0.31s)

watchflakes

gopherbot pushed a commit to golang/tools that referenced this issue Apr 24, 2025
This CL adds the test in the first patchset of CL 647516, which
executes go list directly, thus providing a control for the
substantial gocommand wrapper package.

Updates golang/go#71544
Updates golang/go#73481

Change-Id: I3dbc91cb1144bd5cafbd438817a17abda1c811ae
Reviewed-on: https://go-review.googlesource.com/c/tools/+/667857
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
@gopherbot
Copy link
Contributor Author

Found new dashboard test flakes for:

#!watchflakes
default <- pkg == "golang.org/x/tools/go/packages" && test == "TestRmdirAfterGoList"
2025-04-24 17:16 x_tools-gotip-windows-386 tools@cd9151d4 go@3452d80d x/tools/go/packages.TestRmdirAfterGoList (log)
=== RUN   TestRmdirAfterGoList
    packages_test.go:3456: failed to remove temp dir: unlinkat C:\b\s\w\ir\x\t\TestRmdirAfterGoList1539220585\001: The process cannot access the file because it is being used by another process.
--- FAIL: TestRmdirAfterGoList (0.25s)

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

3 participants