1

我的生产服务器返回以下错误:

MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 81 wakeup listeners added. Use emitter.setMaxListeners() to increase limit
1|pro_app  | 2019-03-19 15:59:01: MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 81 wakeup listeners added. Use emitter.setMaxListeners() to increase limit
1|pro_app  |     at _addListener (events.js:243:17)
1|pro_app  |     at Connection.addListener (events.js:259:10)
1|pro_app  |     at Connection.Readable.on (_stream_readable.js:796:35)
1|pro_app  |     at Connection.once (events.js:290:8)
1|pro_app  |     at Connection._send (/var/www/app/node_modules/http2/lib/protocol/connection.js:355:10)
1|pro_app  |     at runCallback (timers.js:696:18)
1|pro_app  |     at tryOnImmediate (timers.js:667:5)
1|pro_app  |     at processImmediate (timers.js:649:5)
1|pro_app  |     at process.topLevelDomainCallback (domain.js:121:23)

尽管我一直在尝试通过增加以下链接中提到的侦听器数量来处理此错误:

堆栈溢出

node.js官网

不管听众的数量有多少,我仍然会收到同样的错误。停止此错误的唯一方法是设置,process.setMaxListeners(0)但我担心这样做会阻止我检测到内存泄漏。

你会建议只设置process.setMaxListeners(0)吗?还是首先确保没有内存泄漏?我一直在寻找内存泄漏检测工具,但没有明确的结果。如果您对这种工具有任何建议,那肯定会有所帮助!

4

0 回答 0