Closed zbjornson closed 5 years ago
duplicate of #135
please correct me if this is not a duplicate ticket
I guess it's the same underlying cause, but two new manifestations.
Gotcha. I assume that the Node.js .unpipe
logic is just calling removeListener
under the hood, in which case the fix being to fixup removeListener
would fix these cases, I would guess. It seems this issue is mentioned in #135 which would help drive whoever picks up the bug to fix to get it covered in a generic way. You could add your above snippet to that issue as well, if you think that would be useful to someone who picks up #135
This module intercepts
res.on
and remaps it tostream.on
. Usingres.once("drain", listener)
multiple times creates a listener leak because this is essentially what happens:For that same reason, it looks like a listener bound with
res.on("drain", listener)
can never actually be removed withres.removeListener
.(Also mentioned in https://github.com/expressjs/compression/issues/135#issuecomment-381899124.)