Skip to content

Memory leak in namespaces #608

Closed
Closed

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

Activity

  1. einaros commented on Oct 31, 2011

    @einaros
    Contributor

    Thank you for this. I'll try reproducing and get back to you shortly.

  2. added a commit that references this issue on Oct 31, 2011
  3. einaros commented on Oct 31, 2011

    @einaros
    Contributor

    That ought to cover it.

  4. samlown commented on Nov 1, 2011

    @samlown
    Author

    Awesome!

    I can't help thinking though that it might also be beneficial to not insert the socket object into the other namespaces in the first place. Is this possible or have I mis-understoud how a part of the system works?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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