Skip to content
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 Server creates temp files in C:\Windows\Temp\nuget in server #3275

Closed
rrelyea opened this issue Oct 12, 2016 · 11 comments
Closed

NuGet Server creates temp files in C:\Windows\Temp\nuget in server #3275

rrelyea opened this issue Oct 12, 2016 · 11 comments

Comments

@rrelyea
Copy link

rrelyea commented Oct 12, 2016

Porting from http://github.com/nuget/home/issues/3635

Filed by @NagarajMasub
we have our own nuget feed in our server,we are using NuGet.Server . C:\Windows\Temp\nuget in this location there are more than 100 gb of nuget files are stored, due to this my server gets hanged, how can i resolve this. Please update me as soon as possible

@skofman1
Copy link
Contributor

@NagarajMasub are the packages you are seeing in C:\Windows\Temp\nuget are package your team uploaded, or something else?

@NagarajMasub
Copy link

NagarajMasub commented Oct 13, 2016

@skofman1 it contains the assemblies which is available in my nuget packages.

@skofman1
Copy link
Contributor

@NagarajMasub if I understand the issue correctly, a retention policy that will remove old versions of packages will help to clean up C:\Windows\Temp\nuget. We have a PR currently in progress that does just that: NuGet/NuGet.Server#18
Meanwhile, you can remove obsolete package manually.

@xavierdecoster?

@xavierdecoster
Copy link
Member

A package retention rule will not have any impact on this.

This may be related to extracting the packages when adding a package to the server. The extracted contents end up in a temporary location, and I'm currently looking at this code path here to check if a proper clean-up happens: https://github.com/NuGet/NuGet.Server/blob/master/src/NuGet.Server/Publishing/PackageService.cs#L40

NuGet.Server uses this OptimizedZipPackage class in the PackageService, which uses a cache backed by the file system. So in essence, the extracted contents in the %Temp%\NuGet location are a cache to speed up the server and reduce memory footprint, as explained here.

It is OK to occasionally clear that cache, but note that every first hit of a package will recreate the expanded directory in the temporary location to recreate the package cache.

@NagarajMasub Are you seeing any internal server errors logged in the HTTP response when adding a file to your server?

I'll close for now as by-design, but feel free to continue the discussion, or if you do see errors in the HTTP response when adding a package, feel free to reopen.

@NagarajMasub
Copy link

NagarajMasub commented Oct 17, 2016

@xavierdecoster thanks for your update, i have below queries,

  1. if every first hit will create a temp cache file , then what is the solution to avoid this..?
  2. we are uploading files in the server by directly copy paste the files in to the required packages path, how can i check http response.?

@xavierdecoster
Copy link
Member

  1. This is by design.
  2. Use nuget.exe push <packageId> <apiKey> -source <yourServerUrl> -verbosity detailed to check the response.

@llyons
Copy link

llyons commented Aug 16, 2017

We also have the issue where c:\windows\temp\nuget gets larger and larger until the space on C: is completely filled and then the nuget server will not take any additional packages and stops responding. Also the operating system crashes because there is no space left. This clearly cant be considered working by design. Maybe I am not understanding that statement. For now we have implemented a periodic scheduled task that removes files older than 2 weeks. I was hoping to implement something withing the nuget server system that would do the cleaning but sounds like that is not in the plans.

@johnradke
Copy link

I've discovered that this has to do with the enableFrameworkFiltering option in the web.config. If I delete C:\Windows\Temp\nuget, set that option to true, and then hit the ~/nuget/Packages endpoint in my browser, I see the C:\Windows\Temp\nuget folder get recreated and filled with a folder for each .nupkg in my source folder. If I delete the folder, set the option to false and refresh the browser, the nuget temp folder does NOT get created.

I also only experience this issue with NuGet.Server version 2.8.2. Upgrading to version 2.14.2 eliminates the temp dir caching, regardless of the enableFrameworkFiltering flag.

@joelverhagen
Copy link
Member

Hey guys, I didn't realize this issue existing until @skofman1 sent it to me (thanks!).

I have a potential fix out for this issue. Also @NagarajMasub re-filed this issue here, where him and I have also discussed this issue a bit: #5230.

copied from #5230 (comment)

... could you try updating to the following prerelease build to see if it fixed your issue? Install NuGet.Server version 3.0.3-jver-big-tmp-21027 from the following package source:
https://dotnet.myget.org/F/nuget-build/api/v3/index.json

(this is a MyGet package source is where CI builds of NuGet.Server go before we published them to NuGet.org)

The PR that produced this build is here, if you are curious:
NuGet/NuGet.Server#48

@johnradke, I'd love to hear if this unblocks you. Note that I made this change on the 3.x train (ASP.NET Web API-based, not WCF).

@joelverhagen
Copy link
Member

I've shipped the fix in 3.1.0, which is published to nuget.org:
https://www.nuget.org/packages/NuGet.Server/3.1.0

Let me know if you run into any other issues or if it resolves the problem for you 😄

@llyons
Copy link

llyons commented Nov 1, 2018

For us, this c:\windows\temp\nuget folder seems to be more related to builds happening than new packages being pushed by developers into the nuget server.

We do have a nuget server on the same machine but this appears to be tied into when builds happen that use nuget files, they get pushed into this temp folder.

is there a way to change the location to a different drive/folder?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants