memory leak when using logger.configure({level:'info'});
See original GitHub issuewinston 3.3.3
memory leak when using logger.configure({level:‘info’});
sample code:
`const winston = require(“winston”) const logger = winston.createLogger({ level: ‘debug’, format: winston.format.combine( winston.format.timestamp(), winston.format.json(), ), transports: [new winston.transports.Console()], });
logger.configure({level:‘info’});
const msg = new Array(1000).fill(‘0123456789’).join(‘’);
const log = () => {
for (let t = 0; t < 100; t++) {
logger.debug(msg);
}
const used = process.memoryUsage().heapUsed / 1024 / 1024;
console.log(mem use: ${Math.round(used * 100) / 100} MB
);
};
setInterval(log, 200);`
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:5
Top Results From Across the Web
Can I stop java.util.logging from contributing to a memory leak?
Short of making Sun fix the Level implementation or changing your library to do away with its custom Level, the only way I...
Read more >Memory leak in legacy logging · Issue #134724 · elastic/kibana
Prerequisites: Kibana v7.16.x or v7.17.x Kibana logging to a file with logging.dest configuration option or cli argument (default for APT ...
Read more >Built-in logging module may lead to memory leak?
I'm using the python built-in logging module in a django project. Using dictConfig, the configuration in settings.py is like this:.
Read more >3 Troubleshoot Memory Leaks - Java - Oracle Help Center
Obviously, your live set may go up and down, but if you see a steady increase over time, then you could have a...
Read more >winstonjs/winston - Gitter
(node:26105) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 unpipe listeners added to [File]. Use emitter.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just tried out winston for a project that’s nearing production, and have had these crashes reported very recently, and just now narrowed it down to winston. Removing winston and reverting the logging back to previous fixes the problem.
Fwiw, our implementation created a single logger like so:
This logger instance is stored in the server’s redux store, and recalled anywhere the app needs to log via redux
getState()
. Same behaviour in our GCP test environments and local dev machines; after some time the process exits with a heap OOM error. Unsure if we’re supposed to be recycling the instance like this, or are meant to flush the logs periodically or something, but for now I’m just reverting until more info comes to light.I’m seeing this in GCP environment too - seem like disabling one line that logs a (large) JSON causes this. As if the js object was retained, and not released.