-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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 when using RedisStore #1303
Comments
parameter to onDisconnect. have Manager.prototype.onClose to check if it is really being called for a request in a different node before subscribing to "dispatch:<client_id>" fixes socketio#1303
@gkostov - are you using this in production? any luck? we (as many others) are still seeing this issue, but unfortunately reaching the limits of using MemoryStore (or, more accurately, the limits of non-Clustered Node.js). |
I have managed to detect three leaks and the above commit only fixes two of them. With this update the server appears in much better shape now. It still leaks of course but survived for few days at stable load with no restarts. |
I think. I fix this problom. two problom exist.
妈的 这个狗屎问题learnboost为什么不改 害的老子增加了一个月的工作量 |
After a LOOOOOT of testing in our production environment (2,000-4,000 concurrent sockets blasting FREQUENT messages), #1371 has resulted in the best solution in our environment. Highly recommend checking it out and/or testing it if you have a high-ish volume application. (We also tried #1260, which I believe attempts to solve both the problems that @zhaoerlei notes, but we still found some leaking.) |
I use #1260,but still leak |
@freeman983 try #1371 - it worked for us! |
surespot/socket.io#channelfix --- add memory leak fix |
@freeman983 did you test that change? We are using surespot/socket.io#channelfix and it's much better but not perfect |
@Feroc1ty ,I do test for this change ,please see |
thanks I did the testing also and it's great :) |
@freeman983 /**
Transport.prototype.end = function (reason) {
} |
Setup
node 0.10.12
socket.io 0.9.16
Running just one instance of the socket.io server.
Symptom
The redisSub object accumulates listeners for the "message" event and keys in the
subscription_set
map for each connected client and removes only some of those when the client disconnects.Reproduce
The leak is very easy to spot using this code:
It runs the socket.io server with a RedisStore. A client is set to connect, stay connected for awhile, disconnect, then wait for one second and the cycle repeats.
In the console you'll get logs for the length of
io.settings.store.sub._events.message
and the number of keys inio.settings.store.sub.subscription_set
.When a client connects both grow by 5. On disconnect - "message" listeners decrease by 2 (3 remain) and
subscription_set
looses 3 keys (2 remain which are always likesub message:jpUygh7mf-tN1A-xulsB': true
andsub disconnect:jpUygh7mf-tN1A-xulsB': true
).I hope this will be helpfull.
The text was updated successfully, but these errors were encountered: