Memory leak
I have been outputting the internal data structure length and noticed the following:
(metric) server connections (132)
(metric) socket.io clients (576)
(metric) socket.io handshakes (598)
(metric) socket.io connected (576)
(metric) socket.io rooms (21)
(metric) socket.io roomClients (578)
(metric) socket.io open (119)
(metric) socket.io closed (1459)
There are way to much objects in our internal closed object. So something is not getting cleaned up properly.
Node 0.4.8 Socket.IO server & client are 0.8.6
real connection count: ~30 | Open: 37, handshaken: 40, closed: 228, closedA: 1162 real connection count: ~80 | Open: 542, handshaken: 701, closed: 980, closedA: 969
the numbers are just so random at times...
seems like a very serious issue...
is it safe to loop over those objects (closed and closedA) every once in a while and delete all keys? - actually that doesnt free any memory anyways so its useless
what is closeA internally? will "client not handshaken client should reconnect" failed handshake IDs also end up there?
edit:
31 Oct 21:29:46 - Open: 102, handshaken: 121, closed: 1131, closedA: 13783 (~70 real connections)
edit:
Nov 13:06:41 - Open: 47, handshaken: 61, closed: 1489, closedA: 362424 <- after 10 hours of uptime, WTF?
https://github.com/thekiur/socket.io/commit/9e92075cbb385d6037876c7cfedd8227f92b1a10
That was pulled to master so this issue is gone?
@thekiur that only fixes one small part of it, the closed object is still leaking data.
@thekiur a possible work around for this would be: https://github.com/observing/socket.io/commit/6d458d86697ddd8b10f68905fec02ca9feb3541c
Which doesn't solve the issue, but it does clean up the closed objects.
Hey,
Do you use this on prod ? can i safe merge this to 8.7 ?
This workaround is good, the mem stops leaking, but on production with many clients it eats all the cpu so in my case I just did cleaning the sockets on a timeout.
How did you cleaned the sockets. i have the same problem the memory very big
the same!~
Is problem solved?
when client disconnect , transport should notify other server. i have change the transport , and maybe resolved it. https://github.com/wanghongxing/socket.io/commit/4ed630377681171948e4f7cedf91d07a95c36a57