From 6e57366b7f8a2d2b2bcea542ba9de6146df645be Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 13 Oct 2020 13:14:39 +0530 Subject: [PATCH] address a file descriptor leak --- lib/storage/file.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/storage/file.js b/lib/storage/file.js index 16f8c8ba7..d9d3f7c89 100644 --- a/lib/storage/file.js +++ b/lib/storage/file.js @@ -779,9 +779,11 @@ const messageBin = (env, chanName, msgBin, cb) => { chan.writeStream.write(msgBin, function () { chan.onError.splice(chan.onError.indexOf(complete), 1); complete(); +// It seems like this reintroduces a file descriptor leak if (chan.onError.length) { return; } if (chan.delayClose && chan.delayClose.clear) { chan.delayClose.clear(); + destroyStream(chan.writeStream, chanName); delete env.channels[chanName]; } });