在做分页的时候,频繁点击下一页,报错。
错误信息如下:
(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
at addListener (events.js:160:15)
at Server.connect (e:\work\blog\node_modules\mongodb\lib\server.js:291:17)
at Db.open (e:\work\blog\node_modules\mongodb\lib\db.js:190:19)
at Function.Post.getAll (e:\work\blog\modles\post.js:57:13)
at e:\work\blog\routes\index.js:13:14
at Layer.handle [as handle_request] (e:\work\blog\node_modules\express\lib\router\layer.js:82:5)
at next (e:\work\blog\node_modules\express\lib\router\route.js:110:13)
at Route.dispatch (e:\work\blog\node_modules\express\lib\router\route.js:91:3)
at Layer.handle [as handle_request] (e:\work\blog\node_modules\express\lib\router\layer.js:82:5)
at e:\work\blog\node_modules\express\lib\router\index.js:267:22
(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
at addListener (events.js:160:15)
at once (events.js:185:8)
at connectHandler (e:\work\blog\node_modules\mongodb\lib\server.js:265:19)
at g (events.js:180:16)
at emit (events.js:95:17)
at e:\work\blog\node_modules\mongodb\node_modules\mongodb-core\lib\topologies\server.js:373:23
at e:\work\blog\node_modules\mongodb\node_modules\mongodb-core\lib\topologies\server.js:770:13
at Callbacks.emit (e:\work\blog\node_modules\mongodb\node_modules\mongodb-core\lib\topologies\server.js:84:3)
at null.messageHandler (e:\work\blog\node_modules\mongodb\node_modules\mongodb-core\lib\topologies\server.js:218:23)
at Socket.<anonymous> (e:\work\blog\node_modules\mongodb\node_modules\mongodb-core\lib\connection\connection.js:259:22)
这是什么问题,怎么解决?
5 回复
possible EventEmitter memory leak detected
提示的意思是 可能有内存泄露了
这应该是一种自我保护机制吧。
内存泄露了吧?
默认的某个事件监听个数是10个,你可能addEventLinstener超过了10次
EDIT:Use emitter.setMaxListeners() to increase limit.
这个提示你可以设置最大监听数
提示里不是说的很清楚么。。 自豪地采用 CNodeJS ionic