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

Only search top level package folders when running the remove pending packages task #1866

Closed
phasemaster opened this issue Jun 27, 2019 · 3 comments · Fixed by #2218
Closed

Comments

@phasemaster
Copy link

phasemaster commented Jun 27, 2019

I have the problem that any choco command I issue takes quite a bit (multiple seconds) of time. This is even the case for something simple like "choco list --local-only".

Investigating this, I found that it is due to a combination of these factors:

  • The RemovePendingPackagesTask performs a full-depth file search of the PackagesLocation searching for pending package files.
  • In some of my packages, I have directory symlinks that point to the actual location of the package data in the tools directory or that point to the source location of the package data on a network share.
  • Some of my packages have large amount of package data (close to 1GB) and the network is not always extremely fast. This causes the full search to take up to few tens of seconds.
  • There is no way to prevent choco from searching full-depth, e.g. by marking the large or remote package data subdirectory somehow.

I wonder if it is really necessary to search a symlinked subdirectory for pending package files (since they are never copied around anyway). But in any case, I would be really happy if I could at least have the possibility to tell choco to not search a subdirectory (taking the responsibility myself if anything bad happens due to not searching, of course).

@ferventcoder
Copy link
Member

@phasemaster interesting set up - glad to know what it is as that provides context. I think we can definitely accommodate this aspect.

@ferventcoder ferventcoder changed the title Allow some control of full-depth file search on every command RemovePendingPackagesTask - search only top level level package folders Jul 2, 2019
@ferventcoder ferventcoder changed the title RemovePendingPackagesTask - search only top level level package folders remove pending packages task - search only top level level package folders to clean up Jul 2, 2019
@ferventcoder ferventcoder added this to the 0.10.16 milestone Jul 2, 2019
aerotog added a commit to aerotog/choco that referenced this issue Oct 20, 2019
@ferventcoder ferventcoder self-assigned this Oct 30, 2019
aerotog added a commit to aerotog/choco that referenced this issue Oct 31, 2019
Previously, chocolatey would search all sub directories when trying to
remove pending packages as part of other commands. This was causing
several second execution times when sub directories were large and/or
symlinked on a network drive.

By restricting the cleanup to the top directory only, the command
execution times will be much more consistent.
@jimis
Copy link

jimis commented Jan 19, 2021

I found this issue while trying to skip RemovePendingPackagesTask. On Github Actions, the first execution of choco takes minutes, and the debug log indicates that task is the reason.

Tue, 19 Jan 2021 11:21:36 GMT Received arguments: install ccache --version 3.7.12 --yes --no-progress --not-silent --verbose --debug
Tue, 19 Jan 2021 11:21:36 GMT RemovePendingPackagesTask is now ready and waiting for PreRunMessage.
Tue, 19 Jan 2021 11:21:36 GMT Sending message 'PreRunMessage' out if there are subscribers...
Tue, 19 Jan 2021 11:21:36 GMT [Pending] Removing all pending packages that should not be considered installed...
Tue, 19 Jan 2021 11:23:17 GMT Performing validation checks.

See the timestamps in the last two lines. I assume it takes that long because the runner has pre-installed a ton of packages.

Is it possible to somehow skip this step?

@mojojoseph
Copy link

I found this issue while trying to skip RemovePendingPackagesTask. On Github Actions, the first execution of choco takes minutes, and the debug log indicates that task is the reason.

Is it possible to somehow skip this step?

I've run into the same situation - RemovePendingPackagesTask is following symlinks in installed package directories (notably rsync which has a C -> C:\ link). Hopefully PR #2218 can get on the train.

gep13 added a commit that referenced this issue Apr 16, 2021
(#1866) Avoid recursive search for pending package removal
@gep13 gep13 closed this as completed Apr 16, 2021
gep13 added a commit that referenced this issue Apr 19, 2021
* stable:
  (#1861) Improves terminology in help documentation
  (#1998) Add authorization header to Get-WebFile
  (maint) Repalce RawGit with raw.githack.com CDN
  (#1899) Remove unused variables
  (GH-1060) Add BeforeInstall parameter to Install-ChocolateyPackage.ps1
  (maint) Improve log message
  (GH-2092) Take all registry keys into account
  (GH-1364) Template create .nuspec encoded without BOM
  (#1866) Limit pending package removal to top level
  (GH-2203) Get-ChocolateyUnzip add unzipLocation alias
  (GH-1889) Fix: Removal of ApiKey broken
  (#2114) Remove unused variable
  (GH-2048) update deprecation note to outdated
  (maint) Spelling and grammar fixes
  (maint) Replace tabs with spaces
  (#2078) Skip importing Chocolatey GUI Extension
  (#2227) Use latest Mono and Ubuntu on Travis
steviecoaster added a commit to steviecoaster/choco that referenced this issue May 11, 2021
…GH2112

* 'GH2112' of https://github.com/steviecoaster/choco:
  (chocolatey#2112) Add msp support to Install helper
  (maint) Switch to using a Regex match
  (maint) Change formatting
  (maint) Remove use of PowerShell aliases
  (maint) Replace " with '
  (chocolatey#2044) Fix for changing $env:Temp
  (chocolatey#2259) Switched to versioned NuGet.Core
  (chocolatey#2111) Deep copy config
  (chocolatey#2244) Add Mac build into main workflow
  (chocolatey#2238) Mono build don't hardcode xbuild path
  (maint) Fix artifact paths on AppVeyor
  (chocolatey#2244) Fix syntax for running on Windows
  (chocolatey#2244) Initial workflow for Windows and Ubuntu
  (doc) Remove Mono instructions for other distributions
  (doc) Add Ubuntu 20.04 mono install instructions
  (chocolatey#2227) Bump Mono version in Dockerfile and README
  (chocolatey#2236) Mono test work with merged usr systems
  (chocolatey#2190) Clarify help for SpecificFolder parameter
  (chocolatey#1962) Use different message on error
  (chocolatey#1861) Improves terminology in help documentation
  (chocolatey#1998) Add authorization header to Get-WebFile
  (maint) Repalce RawGit with raw.githack.com CDN
  (chocolatey#1899) Remove unused variables
  (chocolateyGH-1060) Add BeforeInstall parameter to Install-ChocolateyPackage.ps1
  (maint) Improve log message
  (chocolateyGH-2092) Take all registry keys into account
  (chocolateyGH-1364) Template create .nuspec encoded without BOM
  (chocolatey#1866) Limit pending package removal to top level
  (chocolateyGH-2203) Get-ChocolateyUnzip add unzipLocation alias
  (chocolateyGH-1889) Fix: Removal of ApiKey broken
  (chocolatey#2114) Remove unused variable
  (chocolateyGH-2048) update deprecation note to outdated
  (maint) Spelling and grammar fixes
  (maint) Replace tabs with spaces
  (chocolatey#2078) Skip importing Chocolatey GUI Extension
  (chocolatey#2227) Use latest Mono and Ubuntu on Travis
  (chocolatey#2205) Remove mention of private repository
  (chocolatey#2205) Update remaining URLs to new location
  (maint) Remove unnecessary whitespace
  (chocolatey#2231) Change default repository URL
  (maint) Remove unnecessary whitespace
  (chocolatey#2205) Update all chocolatey.org/docs URLs
  (maint) Remove unnecessary whitespace
  (chocolatey#2205) Update automatic-packages docs links
  (doc) Update to prefer # rather than GH-
  (maint) Fix replacement
  (maint) Revert change to earlier commit
  (maint) Fix spelling mistake
  (maint) Fix spelling mistake
  (doc) Update script to Statiq format
  (maint) Add missing backtick in example
  (maint) Added explicit link to new function name
  (maint) Fix spelling mistake
  (maint) Fix spelling mistake
  (maint) Fix spelling mistake
  (maint) Fix spelling mistake
  (maint) Fix spelling mistake
  (maint) Fix spelling mistake
  (maint) Remove generated docs files
  (maint) Add docs/generated folder to ignore list
  (chocolateyGH-2105) Update link to Chocolatey workshop
@gep13 gep13 changed the title remove pending packages task - search only top level level package folders to clean up Only search top level package folders when running the remove pending packages task May 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment