Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory Leak caused by unique Winston categories #141

Open
uPaymeiFixit opened this issue May 31, 2024 · 2 comments · May be fixed by #142
Open

Memory Leak caused by unique Winston categories #141

uPaymeiFixit opened this issue May 31, 2024 · 2 comments · May be fixed by #142

Comments

@uPaymeiFixit
Copy link

uPaymeiFixit commented May 31, 2024

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.

var loggerCategoryRandomiser = Math.floor(Math.random() * (1000000000 - 100 + 1)) + 100;

To my knowledge, this logger is never closed, and so new Winston loggers pile up on the heap.

@uPaymeiFixit
Copy link
Author

It's worth noting this issue (and several others) have already been fixed in Paciolan's TypeScript fork of this SDK.

uPaymeiFixit added a commit to uPaymeiFixit/cybersource-rest-client-node that referenced this issue May 31, 2024
Assuming there is no significance in having a unique logger for each call, this fixes CyberSource#141
uPaymeiFixit added a commit to uPaymeiFixit/cybersource-rest-client-node that referenced this issue May 31, 2024
Assuming there is no significance in having a unique logger for each call, this fixes CyberSource#141
@uPaymeiFixit uPaymeiFixit linked a pull request May 31, 2024 that will close this issue
@uPaymeiFixit
Copy link
Author

I've created a PR to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant