Skip to content

Memory leak in namespaces #608

Closed
Closed
@samlown

Description

@samlown

Hi,

While trying to produce a list of sockets currently connected to the server I discovered a minor memory leak. When using several namespaces, for some reason each connection to the server creates a new socket instance in each namespace's object, despite only one being required.

When the client disconnects, only the specified namespace's socket object is removed, all the other namespaces are left with an empty socket instance with disconnected == false.

This can be seen by listing a namespaces sockets, connecting to a different namespace, closing, then refreshing the first namespaces sockets list. Quick pseudo example:

io.of('/drivers').sockets.length == io.of('/riders').sockets.length == 0
# Client connects to '/drivers'
io.of('/drivers').sockets.length == io.of('/riders').sockets.length == 1
# Client disconnects from '/drivers'
io.of('/drivers').sockets.length == 0
io.of('/riders').sockets.length == 1

Cheers,
sam

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions