-
Notifications
You must be signed in to change notification settings - Fork 253
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
The SDK resolver "NuGetSdkResolver" failed to run. The process cannot access the file 'nugetorgadd.trk' because it is being used by another process. #7503
Comments
Update: discovered original discussion associated with the checkin of the code in question: |
hey @cclauson thanks for the issue. The trk file is just a blank file used to track if we have created an user-wide nuget.config so we don't create again if the user explicitly erased it. I'm curious about how you got this issue since we don't hold any locks for that file apart from the code you provided (where we just create it), if you could find a way to reproduce this more consistently I would love to investigate the cause of this! |
@PatoBeltran / @rrelyea the problem is that there is no cross-process mutex on this block of code in the
This code is not concurrency-safe. We encountered this break on build servers where many nuget processes are run concurrently. Given enough processes and enough machines, the breaks became regular enough that we had to mitigate them by adding a single 'nuget config' call before running anything else. You can simulate the error condition consistently via this code snippet:
|
This is some great sleuthing, thank you! We prioritize issues based on upvotes and impact on our users. Please let us know if you continue seeing this issue, and how often you do. |
Since today (2022-02-22 around 9 CET / 8 UTC) this is happening more often on Azure DevOps pipeline agents. All our build jobs use
Environment
|
We are seeing the same issue today (2022-02-22 around 1am CST). It is failing pretty consistently.
|
The issue I ran into seems to be related to dotnet 6.0.200, forcing 6.0.100 like this got us past the issue
|
We're seeing this more frequently on both Azure DevOps build agents and github build agents (both ubuntu). Running
It appears that whichever package is installed first is failing, and the second one is succeeding. I'll try @bergbria 's trick of calling |
The creation of this file was introduced in NuGet/NuGet.Client#3907 and the behavior was changed in NuGet/NuGet.Client#4338 which would have been released in |
This workaround seems to work: Run # dotnet nuget list source is to fix race condition in dotnet tool restore. Remove when https://github.com/NuGet/Home/issues/7503 is fixed.
- name: Install dotnet tools
run: |
dotnet nuget list source
dotnet tool restore I'm not yet 100% confident that this is reliable (I haven't analyzed the code paths thoroughly), but seems like it should be; and I have a few test runs supporting that. Since |
Yes, in this other issue/PR, I recommended using The reason there is because they have tests running in parallel where each test invokes a new On the other hand, if MSBuild is invoking many instances of the NuGetSDKResolver in parallel (because multiple tools are being restored in the single |
Thank you for the info @zivkan . I should add that this problem is now occurring very frequently with just a single shell call to |
I'm experiencing the same thing on github actions at the moment. |
This bug has the same root cause as #11607. Closing this one as a duplicate, despite being older, so it's easier to show management how many recent upvotes that issue has, so please add a 👍 to that issue |
Should solve occasional test failures (`dotnet tool restore` fails) See NuGet/Home#11607 (comment) (via NuGet/Home#7503 (comment))
I'm still facing this problem. |
Currently trying to troubleshoot an issue which is intermittently happening on our continuous integration server. I can't consistently repro, but our build fails with the following error:
error : C:\Program Files\dotnet\sdk\2.1.401\Sdks\MSBuild.Sdk.Extras\Sdk not found. Check that a recent enough .NET Core SDK is installed and/or increase the version specified in global.json.
shortly after this warning:
The SDK resolver "NuGetSdkResolver" failed to run. The process cannot access the file 'C:\Users\cloud-user\AppData\Roaming\NuGet\nugetorgadd.trk' because it is being used by another process.
I've found what I believe to be the relevant code in the NuGet.Client repo under src/NuGet.Core/NuGet.Configuration/Settings/Settings.cs:
This code is a bit confusing to me, it looks like under certain conditions, it checks to see if the track file exists, and if it doesn't, creates it, but leaves it empty. Can anyone shed more light on what the track file is and what's happening here? Additional questions that would be great if anyone has comments on them:
I believe all of the bits that are being run ship with Visual Studio, currently on version 15.8.4
EDIT: Am wondering, would it be possible to work around this by placing a track file with the expected contents in that location? Is there any way to figure out what the expected contents would be?
The text was updated successfully, but these errors were encountered: