Skip to content
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

DefaultMediaReceiver leaks EventEmitter events #96

Open
i8beef opened this issue Jul 12, 2020 · 0 comments
Open

DefaultMediaReceiver leaks EventEmitter events #96

i8beef opened this issue Jul 12, 2020 · 0 comments

Comments

@i8beef
Copy link

i8beef commented Jul 12, 2020

When a Channel is created down in castv2, it automatically registers an event handler on the Client. This means it's important for every created Channel to have its "close" method called when the channel owner goes away. Application.close() does this correctly for the "connection" channel. DefaultMediaReceiver creates a "media" channel, but never properly disposes of it, which means it's leaking EventEmitter subscriptions when the the Client connection is reused over and over to launch / join sessions with new receivers.

Suggestion: Add a "close" method to DefaultMediaReceiver and instruct to always call this when killing instances

https://github.com/i8beef/node-red-contrib-castv2/blob/master/lib/DefaultMediaReceiver.js#L25

You can easily reproduce the underlying issue by opening a connection (3 channels) and then launching and closing DefaultMediaReceivers on it 6 or 7 times (it'll create 2 channels but only properly dispose 1, so its leaking one channel for every instance up to the EventEmitter default warning threshold of 10).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant