我在节点应用程序中收到以下警告:
(node:245) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 wakeup listeners added. Use emitter.setMaxListeners() to increase limit
at _addListener (events.js:260:19)
at Connection.addListener (events.js:277:10)
at Connection.Readable.on (_stream_readable.js:687:35)
at Connection.once (events.js:306:8)
at Connection._send (/mnt/app/node_modules/http2/lib/protocol/connection.js:356:10)
at runCallback (timers.js:651:20)
at tryOnImmediate (timers.js:624:5)
at processImmediate [as _immediateCallback] (timers.js:596:5)
我理解这个事件监听器正在注册的内容超过默认的最多10个监听器。我知道我可以提高这个数字,但我不确定这是否可以解决问题,或者只是掩盖它。
这是在http2 node_module中,但我不知道调用它的是什么。
这是我的package.json:
{
"name": "conciergeapp",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node --trace-warnings ./bin/start"
},
"dependencies": {
"apn": "^2.1.3",
"bluebird": "^3.5.0",
"body-parser": "~1.15.1",
"cookie-parser": "~1.4.3",
"debug": "^2.6.1",
"express": "^4.15.0",
"jsonwebtoken": "^7.3.0",
"mongoose": "^4.8.6",
"morgan": "~1.7.0",
"multer": "^1.3.0",
"nodemailer": "^2.7.2",
"passport": "^0.3.2",
"passport-local": "^1.0.0",
"passport-local-mongoose": "^4.0.0",
"pug": "^2.0.0-beta9",
"request": "^2.80.0",
"socket.io": "^1.7.3",
"socketio-jwt": "^4.5.0",
"xoauth2": "^1.2.0"
},
"devDependencies": {
"gulp": "^3.9.1",
"gulp-autoprefixer": "^3.1.1"
}
}