API - Default logging policy leaks memory
- 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
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