-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MaxListenersExceededWarning #30
Comments
#1 mentions that this was fixed in v1.0.0. That may be true, but it doesn't appear to be fixed on master. |
Hi @gabegorelick - thanks for creating this. Regarding #1, that fix is in reference to a different issue related to listening, which would trigger the same warning. Just to confirm, your proposed solution is simply intended to hack around node's warning, correct? That is, you aren't reporting a leak, just the fact that your application creates these streams with sufficient concurrency to trigger this warning, right? I'm not totally opposed to working around this here, but it also feels like the end result is functionally equivalent to the current behavior, just without the possibility of triggering node's warning. Do you see this as preferable to following the warning's guidance of calling |
You're correct that I haven't encountered a leak, although registering multiple listeners, as opposed to one, increases the risk of a leak in theory.
Correct, the end result should be more or less functionally equivalent. But the advantage is that users don't have to call |
Instead of registering a `process.exit` listener for _each_ instance of `WriteStream`, register a single listener plus a global set of cleanup functions to call. On exit, call all the saved cleanup functions. Inspired by https://github.com/raszi/node-tmp Fixes mike-marcacci#30
Instead of registering a `process.exit` listener for _each_ instance of `WriteStream`, register a single listener plus a global set of cleanup functions to call. On exit, call all the saved cleanup functions. Inspired by https://github.com/raszi/node-tmp Fixes mike-marcacci#30
Hi @gabegorelick, I know you've been waiting on this for a while. I just opened #42 as a more concise alternative to #34. Could you give that a look over and see if it addresses your use-case here? |
fs-capacitor
registers aexit
and aSIGINT
listener for eachWriteStream
created. This means that when constructing a lot of WriteStreams at once, you'll often run into Node'sMaxListenersExceededWarning
:An alternative would be to register a single handler and use a global list of objects to clean up. This technique is used by prominent modules like
tmp
.The text was updated successfully, but these errors were encountered: