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

Choco pack is extremely slow on Windows Environment #3010

Closed
2 of 7 tasks
jetersen opened this issue Mar 23, 2021 · 8 comments · Fixed by chocolatey/choco#2218
Closed
2 of 7 tasks

Choco pack is extremely slow on Windows Environment #3010

jetersen opened this issue Mar 23, 2021 · 8 comments · Fixed by chocolatey/choco#2218
Assignees
Labels
Area: Packages external investigate Collect additional information, like space on disk, other tool incompatibilities etc. OS: Windows

Comments

@jetersen
Copy link

jetersen commented Mar 23, 2021

Description
Choco pack is extremely slow on the windows virtual environments not sure why...

Area for Triage:

Question, Bug, or Feature?:

Virtual environments affected

  • Ubuntu 16.04
  • Ubuntu 18.04
  • Ubuntu 20.04
  • macOS 10.15
  • macOS 11.0
  • Windows Server 2016 R2
  • Windows Server 2019

Image version

Current runner version: '2.277.1'
Operating System
  Microsoft Windows Server 2019
  10.0.17763
  Datacenter
Virtual Environment
  Environment: windows-2019
  Version: 20210316.1
  Included Software: actions/virtual-environments@win19/20210316.1/images/win/Windows2019-Readme.md
  Image Release: actions/virtual-environments@win19%2F20210316.1 (release)

Expected behavior
Choco pack is relatively fast to pack.
Locally it builds in under a seconds.

Actual behavior
Choco pack on Windows when calling "choco pack" directly takes roughly over two minutes.
And calling choco pack via CakeBuild takes over one minutes to pack.

Repro steps
https://github.com/jetersen/test-choco-pack-github-action

  1. Create a nuget spec
  2. and call choco pack
@jetersen
Copy link
Author

jetersen commented Mar 23, 2021

I created a repro:
https://github.com/jetersen/test-choco-pack-github-action

Even when I forgot to checkout the files, it takes over a minute to figure out that the nuspec file is missing.
https://github.com/jetersen/test-choco-pack-github-action/runs/2176728690?check_suite_focus=true

@jetersen
Copy link
Author

jetersen commented Mar 23, 2021

After testing it seems that the initial call to choco is the one being extremely slow...
Also seems 2016 is a bit faster to do the initial call to choco.

@al-cheb al-cheb self-assigned this Mar 23, 2021
@al-cheb al-cheb added investigate Collect additional information, like space on disk, other tool incompatibilities etc. OS: Windows and removed needs triage labels Mar 24, 2021
@al-cheb
Copy link
Contributor

al-cheb commented Mar 25, 2021

Hello, @jetersen
I can reproduce the same behavior. We pre-install a lot of chocolatey packages that's why searching operation for the first time takes soo much time:

2021-03-25 11:57:42,834 5836 [DEBUG] - RemovePendingPackagesTask is now ready and waiting for PreRunMessage.
2021-03-25 11:57:42,840 5836 [DEBUG] - Sending message 'PreRunMessage' out if there are subscribers...
2021-03-25 11:57:42,847 5836 [DEBUG] - [Pending] Removing all pending packages that should not be considered installed...
2021-03-25 11:59:08,041 5836 [DEBUG] - Performing validation checks.

Workaround(temporary rename lib folder) :

- name: DotNet Tool Restore
  run:  dotnet tool restore
- name: rename lib folder
  run: |
       rename-item "C:\ProgramData\chocolatey\lib" "C:\ProgramData\chocolatey\lib1"
       $null = mkdir C:\ProgramData\chocolatey\lib
- name: Choco Pack
  run: choco.exe pack .\helloworld\helloworld.nuspec
- name: Cake Pack
  run: dotnet cake

image

Looks like it's well-known issue:
remove pending packages task - search only top level level package folders to clean up #1866
choco command takes time to initialise. How to skip RemovePendingPackagesTask? #2186
(GH-1866) Restrict pending package removal to top level #1941

cc: @gep13 @ferventcoder

@jetersen
Copy link
Author

@al-cheb I wonder if you recreate these VM every time would it not be better to clean the choco lib folder after all the install of choco packages is done?

@al-cheb
Copy link
Contributor

al-cheb commented Mar 26, 2021

@al-cheb I wonder if you recreate these VM every time would it not be better to clean the choco lib folder after all the install of choco packages is done?

If we clean the lib folder we will break choco packages.

https://chocolatey.org/courses/getting-started/installation-in-detail

Chocolatey packages are installed to ChocolateyInstall\lib, but the software could go to various locations, depending on how the package maintainer created the package.

Some packages are installed under ChocolateyInstall\lib, others - especially packages that are based on Windows installers (.msi files) - install to the default path of the original installer (which is most likely within Program Files).

@jetersen
Copy link
Author

Right forgot that some packages live in the lib folder 😅

@al-cheb
Copy link
Contributor

al-cheb commented Apr 2, 2021

Close as external.

@al-cheb al-cheb closed this as completed Apr 2, 2021
@gep13
Copy link

gep13 commented Sep 3, 2021

A nee version of Chocolatey v0.11.1 has been released that should address this issue. If we could get it installed on the build agent machine and test to ensure if it is fixed, that would be great. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Packages external investigate Collect additional information, like space on disk, other tool incompatibilities etc. OS: Windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants