-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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: temporary directories left behind on windows-amd64-2012 builder #30789
Comments
Strange. I cannot explain why
I did not debug this failure. But, generally, you cannot delete directory, if some process have open files in that directory. Same if some process current directory is set to directory being deleted or any directory under. I suppose someone needs to reproduce this, and then somehow debug this. Once we know how it happens, we might understand better why only Alex |
I spent some time debugging this with gomote and logging in cmd/go TestMan & temporary hooks/logs in io/ioutil.TempDir. It seems that whatever is making those directories that don't get deleted do NOT come from the same process that runs the test (running the TestMain). I see tons of temp dirs get created from the cmd/go (TestMain) process, but not the ones that cause failures, so I suspect it's a child process (where my logging hook isn't installed) that is creating the directory. Time for more logging, I guess. |
I also would not be surprised that this bug is not Go related. Maybe antivirus is running (or some other Windows program, for example, something that indexes files on disk) and locking our executables at random times. If windows-amd64-2012 computer is configured in a slightly different way than others, that would explain why we see this problem on windows-amd64-2012 only. Alex |
Change https://golang.org/cl/171764 mentions this issue: |
I'm getting tired of builder flakes. Time to find this and either fix it or work around it. |
Failures here don't otherwise affect the build, but they do cause a slow file leak in the user's temp directory. The user deserves at least a cursory warning that something may be amiss. Updates #30789 Change-Id: Id0e72b1967e7f7c88cdc94d532554496653f264b Reviewed-on: https://go-review.googlesource.com/c/go/+/171764 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
I did some exercise #25965 (comment) maybe related to this issue. And I can see vastly different results between my Windows 7 and Windows 10 computers. Maybe similar effect can explain what we see with windows-amd64-2012 builder. Alex |
With Bryan's latest debugging CL, they log https://build.golang.org/log/47129350051d5b9c0600f9421c2680d7610bd4cd
|
So perhaps we should check for the We probably don't want to stall forever if the user has a really slow antivirus installed or something, but a wait of ~500ms or so seems reasonable to me. (Any opinions from the other folks following?) |
Retrying for a bit on |
I second that.
I agree. My experiment #25965 (comment) has -sleep parameter that puts sleep between process exiting and executable deleting, and having -sleep=500ms makes my test pass. Unrelated, but should we also remove defer time.Sleep(5 * time.Millisecond) from windows version of (Process).wait now that it serves no purpose (see #25965 for details)? I find that code is mostly not needed on Windows 10. That code is only needed if you are trying to delete executable immediately after its execution on older Windows version. Alex |
Forget that suggestion - I am getting exited easily now days. We still have plenty of tests that build executable in a temp directory, run the executable and then delete the directory. These all will fail without time.Sleep. Probably many other developers have tests like that too. Alex |
Change https://golang.org/cl/172337 mentions this issue: |
On some configurations of Windows, directories containing executable files may be locked for a while after the executable exits (perhaps due to antivirus scans?). It's probably worth a little extra latency on exit to avoid filling up the user's temporary directory with leaked files. Updates #30789 Change-Id: Iae7fcdd07fb9ecfb05967cfe0c8833db646d2f85 Reviewed-on: https://go-review.googlesource.com/c/go/+/172337 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
So far so good. Will keep an eye on the builders today to verify that this is resolved. |
Five |
😩 |
Timed out in state WaitingForInfo. Closing. (I am just a bot, though. Please speak up if this is a mistake or you have the requested information.) |
The logs for the
windows-amd64-2012
builder (and only that builder, as far as I can tell — CC @alexbrainman) show many flakes at the end of thecmd/go
tests, of the form:(https://build.golang.org/log/177e49c04af866fec137d316334a80a1a5137376)
The test otherwise seems to pass.
That log line comes from here (CC @ianlancetaylor):
go/src/cmd/go/go_test.go
Line 285 in 1650f1b
The fact that the temporary directories start with the prefix
go-build
suggests that they come from here:go/src/cmd/go/internal/work/action.go
Line 227 in 820ad17
I'm not sure what to make of the fact that those flakes are specific to the one builder. Perhaps there is a kernel quirk on that specific version of Windows that causes it not to clean up completely on exit?
(CC @jayconrod)
The text was updated successfully, but these errors were encountered: