-
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
testing: add Windows workarounds to testing.(*T).TempDir's cleanup #44919
Comments
It doesn't make sense for us to add a retry loop around every call to Perhaps on Windows if we get a particular error during |
@ianlancetaylor, thanks for the quick response.
Is it really unreasonable to assume that some people will actually put data that triggers defensive software into the temporary directory? The reason why I filed this issue was actually the fact that I witnessed such failures in tests that only put text (JSON, etc) files there, here on GitHub.
That might do it (and would also probably remove the workaround in cmd/go and some other places), but could cause issues down the line if there is no way to disable that behaviour. Just looking at issues from the last few months I was able to find a few similar ones: #38490, #42224, #44782. So the problem is real, and making everyone wrap every call to Alternatively, we could consider this purely an issue with Windows and Windows Defender and propose the solution of “just disable it”. Currently, I don't have enough information on how easily that could be done in a CI/remote server environment for such cases, as I am not a Windows user myself. |
It's not unreasonable. But the same applies to every directory everywhere. Why should we add a special case to the testing package? What is special there? I explained what is arguably special about the use in cmd/go, but I don't think that argument applies to the testing package. |
I would argue that the special things here are:
|
I think these arguments in effect apply to every use of And I don't really see why they don't apply to every use of |
@ainar-g what exactly do you propose to do? I understand you want to retry I never see these errors on my computer. But I always disable anti-virus programs (and similar programs) while I develop. These programs slow my computer considerably. If developers / companies are serious about running antivirus software or any other software that monitors their files, they just need to report these problems to antivirus developers. I don't see how your proposal can be implemented in Alex |
Sorry, I'm a bit busy with work currently. I'll try to get some better information about the retriable kinds of errors and how I see it implemented within the next few days. |
After more digging, it turns out that the tests in the code were bad, and I also feel bad for wasting your time. Apologies! |
Thanks for following up. |
In #30789 (CL 172337) a workaround was added to the
go
command to help with theaccess denied
and similar errors when running tests on Windows. The errors are thought to arise because of antivirus software and similar programs interfering. Currently, similar errors can still happen when usingtesting.(*T).TempDir
during its cleanup stage:I think that a similar workaround should be applied there. Applying it manually seems to fix the issue.
The text was updated successfully, but these errors were encountered: