Skip to content

DefaultMediaReceiver leaks EventEmitter events #96

@i8beef

Description

@i8beef

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions