chocolatey / chocolatey/choco

[API] Removing pending packages never happens

Open
#1,380 5 comments 0 reactions 0 assignees View on GitHub
0 - Backlog API Bug
Dominant language
C#
Stars
11.5k
Forks
960
PR merge metrics
No merged PRs in 30d

Description

### What You Are Seeing?

When using chocolatey.lib to run a chocolatey install, if the install fails, the package remains as pending. When attempting to install again, it says that the installation has succeeded as the package is already installed. Logs reveal that the remove pending packages task was scheduled, but could not complete. it seems that the process may be blocking itself.

### What is Expected?

The pending packages should be removed successfully. Ideally automatically before any other command, but it might also suffice if GetChocolatey contained a blocking method along the lines of WaitForPendingTasks() or something like that.

Another solution would be that when installing a package, it checks if the existing package entry is in a pending state and does not consider the package already installed if that is the case.

### How Did You Get This To Happen? (Steps to Reproduce)

1. Initialized GetChocolatey object with Lets.GetChocolatey()
2. GetChocolatey.Set config to install a package
3. GetChocolatey.Run Install failed (specifically in my case, a package with a bad checksum)
4. Run same config again using same GetChocolatey
5. Install succeeds immediately

### Output Log

https://gist.github.com/sxmanton/9fd6beb0e4f9217854f633c78e0bd1f6

Contributor guide

Open the contributing guide

Research direction

Start with the linked output log and trace the GetChocolatey object created by Lets.GetChocolatey(), especially the pending-task cleanup after Run Install fails. Reproduce the failed-checksum sequence with the same object and determine why cleanup blocks itself. Done means pending packages are removed before a retry, or a pending package is not reported as already installed.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.