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

Memory leak in namespaces #608

Closed
samlown opened this issue Oct 31, 2011 · 3 comments
Closed

Memory leak in namespaces #608

samlown opened this issue Oct 31, 2011 · 3 comments

Comments

@samlown
Copy link

samlown commented Oct 31, 2011

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

@einaros
Copy link
Contributor

einaros commented Oct 31, 2011

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

einaros added a commit to einaros/socket.io that referenced this issue Oct 31, 2011
@einaros
Copy link
Contributor

einaros commented Oct 31, 2011

That ought to cover it.

@samlown
Copy link
Author

samlown commented Nov 1, 2011

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?

darrachequesne pushed a commit that referenced this issue Jul 4, 2024
fix a namespace connection error
darrachequesne pushed a commit that referenced this issue Jul 8, 2024
The `main` entry for the `package.json` file is for defining the entry
point. The entry is currently missing the required `.js` extension,
this PR brings it back.
This issue was closed.
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

2 participants