Skip to content

Kill orphaned listing processes on timeout (#4974)#4980

Merged
Gabriel Dufresne (GabrielDuf) merged 1 commit into
mainfrom
fix/choco-process-leak-4974
Jun 22, 2026
Merged

Kill orphaned listing processes on timeout (#4974)#4980
Gabriel Dufresne (GabrielDuf) merged 1 commit into
mainfrom
fix/choco-process-leak-4974

Conversation

@GabrielDuf

Copy link
Copy Markdown
Contributor

This pull request improves the robustness and reliability of package listing operations by adding process tracking and timeout handling for package manager tasks. It ensures that any processes started during package listing are properly tracked and killed if a timeout occurs, preventing orphaned processes. Additionally, it allows individual package managers to opt out of automatic retries when timeouts can't be recovered, as done for Chocolatey.

Timeout and Process Management Improvements:

  • Introduced process tracking for package listing tasks using an AsyncLocal list, and implemented logic to kill all registered processes if a listing task times out, preventing orphaned processes (PackageManager.cs).
  • Refactored the core package listing methods (FindPackages, _getAvailableUpdates, _getInstalledPackages) to use a new RunListingTaskWithTimeout helper, centralizing timeout and process cleanup logic (PackageManager.cs).

Extensibility and Per-Manager Behavior:

  • Added a virtual property RetryListingTasksOnTimeout to allow package managers to specify whether listing tasks should be retried after a timeout. By default, retries are enabled, but individual managers can override this (PackageManager.cs).

Chocolatey-specific Changes:

  • Overrode RetryListingTasksOnTimeout in the Chocolatey manager to return false, disabling retries for Chocolatey listing tasks since fast repair is not possible in this context (Chocolatey.cs).
  • Ensured all Chocolatey listing operations register their processes for timeout management by calling RegisterListingProcess after starting a process (Chocolatey.cs).

@GabrielDuf Gabriel Dufresne (GabrielDuf) merged commit ac36603 into main Jun 22, 2026
3 checks passed
@GabrielDuf Gabriel Dufresne (GabrielDuf) deleted the fix/choco-process-leak-4974 branch June 22, 2026 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Large CPU usage after UniGetUI has been running a few hours

2 participants