CyberSource / CyberSource/cybersource-rest-client-node
Memory Leak caused by unique Winston categories
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 49
- Forks
- 50
- Avg merge
- 18m
- Merged PRs (30d)
- 2
Description
When calling winston.loggers.get("category1"), if a logger with the category of "category1" is not found, it will automatically be created.
This means if we run the following code we will create 1000 separate Winston loggers.
for (let i = 0; i < 1000; i++) {
winston.loggers.get("category" + i);
}
Similarly, when any endpoint is called, the following code is run, resulting in a new Winston logger being created. https://github.com/CyberSource/cybersource-rest-client-node/blob/31baaba047b3efe62e418bd11680599a138644da/src/authentication/logging/Logger.js#L26
To my knowledge, this logger is never closed, and so new Winston loggers pile up on the heap.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/authentication/logging/Logger.js at line 26 and reproduce the category loop or repeated endpoint calls described in the issue. Trace how Winston loggers are created and retained, then verify that repeated calls no longer cause unbounded logger accumulation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100