chocolatey / chocolatey/choco

API - Default logging policy leaks memory

Open
#2,098 1 comment 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 `Lets.GetChocolatey()` and performing various operations over time, millions of logging messages accumulate in `choco._logSinkLogger.Messages`, using gigabytes of heap memory, and causing memory exhaustion.

Note that calling `SetCustomLogging(new chocolatey.infrastructure.logging.NullLog());` fixes the issue.

Maybe logs should be expired, or the `NullLog` logger should be used by default, or the behaviour should be documented and more clearly explained, or something else.

### What is Expected?

No increased memory usage over time.

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

```!csharp
var choco = Lets.GetChocolatey();
while (...) // for a very long time
{
choco.Get(...); // perform operations
}
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the long-running loop around Lets.GetChocolatey(), then inspect SetCustomLogging, NullLog, and choco._logSinkLogger.Messages to determine how the default logger retains messages. Done means repeated operations no longer cause unbounded log retention or memory growth, with the expected default logging behavior documented or verified.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.