Closed Drawaes closed 7 years ago
I tried several different computers, but everything works fine, I can't reproduce this issue. =( @adamsitnik do you have any ideas?
@AndreyAkinshin I could not reproduce it. However I get similar error once in a while (1/100 runs?)
@Drawaes Could you check what is locking this folder?
SO says:
An UnauthorizedAccessException means one of 4 things:
The caller does not have the required permission. The file is an executable file that is in use. Path is a directory. Path specified a read-only file.
So it's either permissions or file in use.
Could it be an anti-virus scanner that has the file/folder in-use?
I was sure I have my c:\code excluded but let me double check
Looks like an over zealous virus scanner is to blame. If I have it off I never see it, but have seen it again with it on. Thanks for investigating, sorry to waste your time.
This error happened to me as well, after some digging, it appears to be the Razer Game Scanner service that was locking BDN.Generated.exe
in the moment it was being deleted.
Stopping the service made it work.
Interesting. For me it was Avast
Considering the lock doesn't last long, a simple retry mechanism could do the trick.
Alright game on. Is it a good idea to retry of maybe not reuse files during the benchmark?
I suspect the issue is rapid generation of executables causes a bunch of different things in different environments to trigger and do a read. If i wanted to benchmark in prod at work I couldn't disable the virus scanner so would be stuck.
Is it a good idea to retry
It's worth a try. We use the following idea in the exporters: if there is a file with target name, we try to delete it; in the case of fail, we pick another name. See https://github.com/dotnet/BenchmarkDotNet/blob/1a8559f24c1e36bf235943d89e67ad83e5fcd9ce/src/BenchmarkDotNet.Core/Exporters/ExporterBase.cs#L29
maybe not reuse files during the benchmark?
Probably it's even a better idea. So, we can generate name of executable file using the job name (instead of fixed BDN.Generated.exe
.) @adamsitnik, what do you think?
We have two problems:
[KeepBenchmarkFiles]
today), or remove them at the end of whole benchmarking process.InProcessToolchain
which does not emit any new executableMine was not the A/V not allowing it to run. It was the overwrite because it was still "scanning" I agree getting around the A/V stopping it from running is fruitless.
I have just changed the default behavior, the default folder/program name is new guid and we remove all artifacts after printing the results.
Please let me know if you ever run into this bug again @Drawaes
Cool! I will turn my evil virus scanner on and give it a crack :) but looks good to me
https://github.com/Drawaes/PerfBenchmarks
If you grab this benchmark and then do
Benchmark ManyReadersRareWrite
I get this following stack trace.