You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run lots of concurrent nuget processes that use that dir
E.g. nuget <install|restore> <various packages found on the devops feed>
Some number of these will fail with errors like the following: The process cannot access the file 'C:\Users\foo\AppData\Local\NuGet\plugins-cache\9501a58c1599e50ae562d549080e69874f89a068$CredentialProvider.Microsoft.exe\Source-Agnostic.dat-new' because it is being used by another process. Errors in packages.config projects The process cannot access the file 'C:\Users\foo\AppData\Local\NuGet\plugins-cache\9501a58c1599e50ae562d549080e69874f89a068$CredentialProvider.Microsoft.exe\Source-Agnostic.dat-new' because it is being used by another process.
Suspected code
I believe the issue is that PluginCacheEntry.UpdateCacheFileAsync is not concurrency safe. Specifically this block:
Could you explain why you're running many nuget processes in parallel?
When you restore a solution, NuGet will restore all the projects in the solution, in parallel. If you're using nuget install to get some packages in a directory, you can use packages.config to list all the packages, then restore that file, and again, nuget will restore them in parallel.
I'm not saying that the error you reported isn't an issue, but it sounds like there are things you might be able to change to get a better experience than if we only fixed the bug you reported.
@nkolev92, it looks like different temp directories were indeed the problem. Thanks for suggesting that; I didn't notice it in my skimming of the code.
@zivkan, I'm running many processes in parallel for a variety of reasons, probably mostly unique to the Office build system (the simplest reason is that there isn't a single solution but it rapidly grows more complex). I'd be happy to discuss the details with you in a different forum if you want, though.
Details about Problem
NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe):
NuGet version: 4.9.4
Detailed repro steps so we can see the same problem
nuget <install|restore> <various packages found on the devops feed>
Some number of these will fail with errors like the following:
The process cannot access the file 'C:\Users\foo\AppData\Local\NuGet\plugins-cache\9501a58c1599e50ae562d549080e69874f89a068$CredentialProvider.Microsoft.exe\Source-Agnostic.dat-new' because it is being used by another process. Errors in packages.config projects The process cannot access the file 'C:\Users\foo\AppData\Local\NuGet\plugins-cache\9501a58c1599e50ae562d549080e69874f89a068$CredentialProvider.Microsoft.exe\Source-Agnostic.dat-new' because it is being used by another process.
Suspected code
I believe the issue is that
PluginCacheEntry.UpdateCacheFileAsync
is not concurrency safe. Specifically this block:Ideally, this method would either use a mutex or simply swallow failures rather than throwing.
The text was updated successfully, but these errors were encountered: