From f9a8c28efa0c052c9ea59bc6453fde88688cd17e Mon Sep 17 00:00:00 2001 From: Patryk Wegrzyn Date: Thu, 30 Jan 2020 23:52:53 +0000 Subject: [PATCH] Remove close listener before next startStreamProcess loop This cause memory leak during fast publishing when leveldb store is used ```VM38 warning.js:27 (node:2090114) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 close listeners added to [MqttClient]. Use emitter.setMaxListeners() to increase limit``` --- lib/client.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/client.js b/lib/client.js index ca003bb6b..8a4f8062e 100644 --- a/lib/client.js +++ b/lib/client.js @@ -1448,6 +1448,7 @@ MqttClient.prototype._onConnect = function (packet) { that.removeListener('close', remove) that.emit('connect', packet) } else { + that.removeListener('close', remove) startStreamProcess() } })