Memory leaks - MaxListenersExceededWarning
See original GitHub issuePlease tell us about your environment:
npm view winston version 3.3.3
What is the problem?
Node will release a warning: MaxListenersExceededWarning
(node:89848) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 5 uncaughtException listeners added to [process]. Use emitter.setMaxListeners() to increase limit
(Use node --trace-warnings ...
to show where the warning was created)
What do you expect to happen instead?
No warning
How to reproduce:
`const winston = require(“winston”); const { transports } = require(“winston”);
// const EventEmitter = require(‘events’); // EventEmitter.defaultMaxListeners = 4;
const createLogger = () => { winston.createLogger({ transports: [ new winston.transports.Console({ handleExceptions: true, }), ], exceptionHandlers: [new transports.File({ filename: “exceptions.log” })], }) }
for (let i = 0; i <= 4; i++) { createLogger(); }`
Removing handleExceptions and exceptionHandlers will work and the warning is not shown
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
The first half was included in yesterday’s release, and I’ve recently merged the second to go out in the next release.
Thank you very much for your fast answer.