Skip to content
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

cmd/go: Windows: link.exe: chdir .: The process cannot access the file because it is being used by another process. #15355

Closed
pquerna opened this issue Apr 18, 2016 · 3 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows
Milestone

Comments

@pquerna
Copy link

pquerna commented Apr 18, 2016

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?

1.6.1

  1. What operating system and processor architecture are you using (go env)?
set GOARCH=amd64
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
  1. What did you do?

Running a go test -v ${PACKAGES} with a proprietary repository. Invoked via a powershell script, like this:

$GOPKG = (go list ./... ) | Out-String -stream | select-string -NotMatch vendor
iex "go test -v $GOPKG"

Currently this is about 60 package names passed into go test.

  1. What did you expect to see?

Tests to build & pass 👍

  1. What did you see instead?

As best as we can see, about 5% of the time in a CI build, we get this build error during the test run:

go build testmain: C:\Go\pkg\tool\windows_amd64\link.exe: chdir .: The process cannot access the file because it is being used by another process.
@ianlancetaylor ianlancetaylor changed the title Windows: link.exe: chdir .: The process cannot access the file because it is being used by another process. cmd/go: Windows: link.exe: chdir .: The process cannot access the file because it is being used by another process. Apr 18, 2016
@ianlancetaylor ianlancetaylor added this to the Go1.7 milestone Apr 18, 2016
@alexbrainman
Copy link
Member

@pquerna

I cannot reproduce your problem.

The "The process cannot access the file because it is being used by another process." is ERROR_SHARING_VIOLATION. And, going by your description, it is happening in Stat in exec_posix.go:26 in os package. Perhaps you can insert some prints to see if we can reproduce it somehow. We need that for new test.

I suspect it fails when GetFileAttributesEx is called on some directory.

I tried making GetFileAttributesEx fail with files. GetFileAttributesEx works even if I open file exclusively (dwShareMode set to 0 of CreateFile) in a different process. GetFileAttributesEx works also if I LockFileEx with dwFlags set to LOCKFILE_EXCLUSIVE_LOCK in a different process. Opening file fails with ERROR_SHARING_VIOLATION, but GetFileAttributesEx works.

I can only make GetFileAttributesEx fail with ERROR_SHARING_VIOLATION for c:\pagefil.sys on my pc. I created https://go-review.googlesource.com/22796 that fixes Stat(c:\pagefil.sys) on my computer. Perhaps CL fixes your problem too. Please try it and let me know.

Thank you

Alex

@quentinmit quentinmit added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 26, 2016
@rsc
Copy link
Contributor

rsc commented May 27, 2016

This can wait until Go 1.8. @pquerna, any reply to Alex? Thanks.

@rsc rsc modified the milestones: Go1.8, Go1.7 May 27, 2016
@gopherbot
Copy link

CL https://golang.org/cl/22796 mentions this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows
Projects
None yet
Development

No branches or pull requests

6 participants