-
Notifications
You must be signed in to change notification settings - Fork 256
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
NuGet should refresh its HTTP cache if it can't find the package requested #3116
Comments
Are you using floating versions, or are you specifying the version exactly in your project.json? |
Version is specified exactly, not floating. Workflow we see is:
|
Today the best solutions for this are to:
We've fixed this kind of thing in the UI scenario for install. |
We're still hitting this often. When we have geo-distributed NuGet feeds and one doesn't have the package, we need to go clear If you click restore packages over and over in VS by right clicking the solution, a user is just shown that the page isn't in the feed. But it is. It's lying. There's an invalid cache in play. I've had to explain this to several of our developers lately and none of them find this intuitive. Can we please not cache 404s indefinitely? Fixing a build server isn't something every dev should have to learn how to do, nor do they necessarily have access to do so. |
I've had this issue myself with NuGet packages just published to a ProGet feed from a TeamCity job, which aren't quite indexed fast enough when I try to reference them elsewhere. As annoying as it is, another workaround I've found is to add/remove as appropriate a trailing slash onto the feed URL (in my case, as the path isn't one ending in |
Still hitting this several times a week. Then I have to go clear the cache folder on dozens of build servers. Please change this behavior. It's not right. It doesn't follow HTTP standards. It's an invalid cache, straight up. |
I'm too hitting this bug frequently. Please fix this, caching 404s indeed doesn't seem like a good idea |
I just spent an hour clearing out the HTTP "cache" folder on a whole series of build agents, instructing developers how to do it locally, and getting builds back in order due to a cached 404 yet again. PLEASE stop caching a 404 forever. This behavior is nuts. I cannot find a single other product or platform that does this...and I looked, really hard. |
Is this behavior going to change in 5.0? We're still hitting it several times a month. While cleaning out build servers due to race conditions is super fun, but I'd rather spend my time on things that matter. Please stop caching 404s. No sane platform does this. And they certainly don't do it indefinitely. |
The last time an iteraction with this from the team was #3116 (comment) - which happens to have been November 2017 This is pretty bad in managing this as an incident report and whilst this does not currently affect me, I can sympathise with the others on this thread that it does affect. This effect is undesirable at best and therefore should be prioritised to be changed in a future release. The fact that this has been hitting @NickCraver and team enough that he has come and replied 3 times since his original comment April 2018 should show that this requires better prioritisation than this is currently getting |
Why hasn't this been fixed already? |
Appreciate the feedback. Will try to get this fixed early in 5.x |
@rrelyea, Setting |
@rrelyea fixing it for a new version is not acceptable, it should be fixed in minor version on all version currently deployed. Caching HTTP (esp. 404) requests is just a bad practice and a design flaw. Fixing it ASAP should be considered CRITICAL. |
@nkolev92 whats the best solution here? IMO, not caching 404s seems like the right option. Shouldn’t have adverse side effects. If a package is not found, build breaks and hence not something folks run repeatedly unless they fix the availability of package or change the dependency graph to an available version. Or we could expire 404 cache in a min or some small time period. I would still vote for first option. |
I guess the misconception is that we cache 404s. We could consider retrying if we get a cache response that doesn't contain the requested version, as suggested by @ericstj , but that could have an effect on performance, which we should consider. |
You could do a version list retry if the requested version is higher than any in the cached list, right? |
Yeah the special refresh logic could be, the requested version is higher than the one in the cached list, or it could be that the version is missing altogether like the OP suggested. |
@karann-msft - Would you expect the environment variable workaround to also work within visual studio? I could make it work when running msbuild from the developer command line, but within visual studio doing a rebuild-all did not work as expected to fetch transitive packages right after they are available on the internal nuget server. I also tried settings the properties via <Project>
<PropertyGroup>
<RestoreForce>true</RestoreForce>
<RestoreNoCache>true</RestoreNoCache>
</PropertyGroup>
</Project> |
According to NuGet/Home#3116 (comment) --no-cache actually doesn't ignore packages folders, but only caches HTTP requests.
@nkolev92 What's the status of a 'real' fix here? It's pretty clear that there is a workaround, but I'd like a fix that doesn't involve knowledge of the underpinnings of feed infrastructure (e.g. what's the package publish time of my input feeds?). .NET has been hitting this pretty regularly lately (we removed our http cache clear a bit back). I understand that there are some complexities here. In .NET's case, we look for exact version matches in all cases, so the error path (package version not found in http cache, fallback should be to re-request) is correct and should not affect performance. On the other hand, when * versioning or version ranges are in use, then things get complicated. I think in those cases, you either need to get more info from the package feeds (e.g. a simple bit that indicates whether a new version of X package has been published), or you cannot use the http cache altogether from a correctness standpoint. I lean more towards the second option in those cases. |
@mmitche Are the problems in .NET build still related to MSBuild SDK's? If so, then does MSBuild's SDK resolver honor |
Not sure, @riarenas is investigating. We had a cache clearing step in the builds before (I think it was an explicit initial clear), but it was removed at some point. |
@mmitche - Can you use the RestoreNoCache env variable mentioned in #3116 (comment)? |
Yes, we believe we can and we're adding it back into our builds. But I'm more interested in a fix for the underlying issue. |
The old nuget-cache clearing in Arcade's build targets/scripts weren't helpful for MSBuild SDK's even in the past, unfortunately. The MSBuild SDK resolver did its own NuGet calls I believe (probably still does), and didn't respect |
@vatsan-madhavan I don't think that we're seeing those problems in these cases. All of these are post msbuild SDK-install restore issues. |
I think I'm encountering this. It is not clear from the massive number of comments above what a good work around is. |
Yes, I was.
worked. |
will there ever be a fix for this issue? |
Similarly if the feed sends back |
When will this be fixed? This bug is really disruptive to my nuget workflow; after I push a new package version to GitHub packages, visual studio will claim the new version does not exist for a good 15 minutes (presumably until the http cache for the nuget server Manually clearing all nuget caches works but this feels like killing a mosquito with a howizer. Plus, it requires me to restart Visual Studio every single time I update a package. All in all a huge pain in the behind. This feels like it should be very easy to fix! Come on Microsoft! |
We are facing the same issue. Really disturbing for CI Pipelines which use a nuget repository for exchanging artifacts |
Still bumping in to this issue... Cost me a few hours to get to the bottom of. |
Still facing the same issue. |
Still facing the same issue, although the --no-cache appears to work it is confusing why this isn't default behavior. Can't find the version and refuses to take a look. |
This bug is very much still present & it's a total mess. Visual Studio's UI actually offers me my newly published package outright. Even if you want to make a case that this behavior makes sense in a build agent environment, it makes entirely no sense to have the local development environment crash on a random cache while even the UI is smarter than that. |
We see restore failures when we update a project to consume a package that was just published. We can use
--no-cache
to workaround it, but that shouldn't be necessary.It seems like NuGet should realize it is running from a cache, and attempt to refresh that cache, before failing the restore because it cannot find the package.
This would still let the common case be fast while not failing in the case that the cache was stale.
The text was updated successfully, but these errors were encountered: