question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if youā€™re still stuck at the end, weā€™re happy to hop on a call to see how we can help out.

[Bug]: When using winston v3 on node14.18.3, there seems to be a memory leak event.

See original GitHub issue

šŸ”Ž Search Terms

memory leak

The problem

I found memory leaks when using winston v3.7.2.

node test-winston.js 2> /dev/null
RSS: 28.9921875 MB
heap used/total: 4.790740966796875/8.57421875 MB
...
... snip ...
...
RSS: 195.984375 MB
heap used/total: 49.476966857910156/50.82421875 MB

What version of Winston presents the issue?

3.7.2

What version of Node are you using?

v14.18.3

If this worked in a previous version of Winston, which was it?

v2.4.5

Minimum Working Example

const w = require('winston')

setInterval(() => {
    w.error('test'.repeat(100))
}, 10)

setInterval(() => {
    const MB_DIV = 1024 * 1024;
    const usage = process.memoryUsage();
    console.log(`RSS: ${usage.rss / MB_DIV} MB`);
    console.log(`heap used/total: ${usage.heapUsed / MB_DIV }/${usage.heapTotal / MB_DIV} MB`);
}, 1000);

Additional information

In v2.4.5, the increase in memory usage has not occurred as in this case.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ahmedtalhakhancommented, Oct 24, 2022

@zizifn We are getting the issue with transport configured as below

transports: [
			new winston.transports.Console()
		],
0reactions
wbtcommented, Nov 4, 2022

@wbt Iā€™m using node v13.8.0 and latest version of winston logger. Also, I have opened a separate question regarding the issue we are facing and have added all the details along with how we can reproduce the issue as well: #2233, as weā€™re able to reproduce the issue pretty much every time, Kindly check this and provide your feedback.

That doesnā€™t provide ā€œall the details along with how we can reproduce the issueā€ - it isnā€™t even logging one message, let alone enough to be overwhelming

Also, it is high priority issue for us as it is effecting our prod environment. If it doesnā€™t get fixed, weā€™ll unfortunately have to consider other loggers.

That is not the threat you might think it is. If you need contracted reliability youā€™ll have to pay a service provider for that.
You can probably pay less for an engineer to start from something that mostly works but has a few bugs (and contribute those working solutions back to the community, where the benefits can be all shared and better maintained) than to start from scratch. If you think another logging library is a better starting point, please feel free to use that. If youā€™re interested in providing some serious funding to the Winston project, please say so. It currently has none, and businesses relying on it have no right to insist that very-limited-time volunteers burn hours trying to fix issues that you and not we are encountering, especially when provided reports donā€™t make it easy to reliably reproduce the problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why are strings passed to winston kept in memory, leaking ...
This was a bug in Winston related to how it used streams. It was fixed in a pull request, you can read more...
Read more >
Node.js Memory Leak Detection: How to Debug & Avoid Them
The use of setTimeout, setInterval, Observers, and event listeners can cause memory leaks when heavy object references are kept in theirĀ ...
Read more >
Read more - GitHub
v8.11.1 (2022-05-13) * Fixed an issue with winston instrumentation that ... to resolve all promises in your application will result in memory leaks...
Read more >
Node Cookbook - DOKUMEN.PUB
node greeting.js. 3. Exit the program using CTRL + C. 4. We can now tell the program what it should do each time...
Read more >
newrelic/NEWS.md - UNPKG
It appears several objects created by grpc-js (`ChannelImplementation` and ... issue where capturing axios request errors could result in a memory leak.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found