-
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 #1015
Comments
Hi, I had this issue long ago and spent a long time trying to figure it out. The closest I could get was to just disable "websockets" as a transport. Sad to do that, but that was the only thing keeping memory safe. |
Hi, Thank you. That is sad because that's the transport that we really would like to use, since our users will only use Chrome in the future. |
Same with me on Socket.io 0.9.10, NodeJS 0.8.10. Websocket is leaking memory with 600 concurrent connection, rss went up to around 900MB. I have to restart every hours or else, it will be really hard to connect to server after consume this much memory. |
Heha, you can probably install nodetime and try to figure out if you have a leak We were having to many jsonp-polling requests. We were able to get down from 402 req/s to 42 req/s And finnaly we got an error:
this.response.writeHead(200, {
So I guess our problem is with socket.io. |
I already got nodetime installed. I already used node-webkit-agent too. Nodetime cannot pinpoint the problem because sample object is quite random when use heap snapshot. For node-webkit-agent, it looks better, can drill down more but still, very hard to pinpoint a problem. There's no leak from one large object or else it would be caught very easy. I already tried using only xhr-polling and memory changed from 900MB/hour to 100 MB/hour but it's too slow for our real-time game. Not sure if jsonp is faster than xhr-polling or not. |
I can confirm. Our server will also eventually run out of memory and start to use swap during load when using socket.io and websockets. I will try to do a baseline with only socket.io, without express or other requires. I will run more tests but currently using: node v0.8.9 Disabling websockets significantly reduces memory load. I am currently using jsonp-polling and update this post with results at then end of the week. |
Real culprit is in One way to fix this problem is change node to version 0.4.12. Websocket will work smoothly with that version. However, lots of tools will be disable too like Nodetime, node-webkit-agent(can use node-inspector instead but I think it's harder to use.) including native cluster which introduced in Node 0.6 (may use other library instead). Another way is use XHR, JSON-P instead which is a lot slower. |
Thanks. I will give 0.4.12 a try on our system this week. I'm also not sure that a lot of npm stuff will still work. |
Still, cannot rely on NodeJS 0.4 much because engine.io (new core for Socket.io 1.0) will support only NodeJS 0.6 or higher. Really make me a hard decision to stay on 0.4 or try restart node 0.8 every x hour instead. :( |
I agree but for my purposes I'd rather not have to restart the server consistently versus the usual weekly reboot. As it stands right now in any high use situations it's a choice between potential service interruptions or using an old version. I plan on giving engine.io and socket.io 1.0 some time to stabilize before going into production. I've been testing my current setup using 4GB of ram and I can only get to about 200-300 users before memory is sucked up in a few hours. I'm really not doing much other than some redis pubsub and relaying messages. |
Actually making engine.io work on 0.4 again wouldn't be that hard. It used to be compatible until a few weeks ago. |
@guille Wow. Great to hear! :) |
Dears, sorry my ignorance, but I have a very long message on my console finnish with this: After a very long time I have the result on my client. Is this the same issue? |
Whatever is causing this bug pretty much renders socket.io and websockets on node useless is a large scale production environment. I have been trying to track this down but I am not sure where its leaking. Sockjs has the same issues so I think its the websocket library not doing something correctly with the new versions of node. {Edit Sockjs not using the same websocket library} It's eating 3 gigs of ram on one server will under 100 people connected. |
Sockjs isn't using the same WebSocket library as Socket.IO does. So there is something else going on here. |
@nodenstuff did you try with socket.io master ? (uses |
Thanks guys. I'll pull down the most recent from github and give it a try on node 0.8.12. |
Master still leaks. Sent from my iPhone On Oct 16, 2012, at 12:38 PM, Guillermo Rauch [email protected] @nodenstuff https://github.com/nodenstuff did you try with — |
updated to node 0.8.14 - will update this post accordingly if issue is fixed Not going to do any charts or anything - newest node is no longer crashing our server during peak load - I'd say thats an improvement 6 hours - ram usage has been stable but increasing VIRT 671M RES 37096 SHR 4820 Oct 28 - sever started swapping and crashed - looks like issue is still there just not as bad :S |
After some configuration with mysql and dropping all but jsonp and websockets - we've managed to stay stable. There is still a very slow memory leak - and some reconnection issues here and there trying to track it down |
Same issue here, I've tried running 0.9.10 with node 0.9.3 and 0.8.14 on win2003server 32bit, Takes it about 6 hours on my test setup, with 2k concurrents, after seeing 200k connections. Some stats before the crash: Node version: v0.9.3 |
Node 0.4 is not needed... |
@rickgbw It works! Thanks! |
@rickgbw Thanks for pointing that out =) After around 200K connections the server crashing in XHRpolling / JSONPpolling with "this.response" is undefined, I've added checks if response is undefined all around the http-polling now, let's see if it helps. |
nodejs/node-v0.x-archive@2433ec8 just landed which looks promising. |
I just setup stud to terminate ssl and now node do not need to process ssl anymore. Now, my memory consumption decrease about 3 times. Maybe this bug relate to using wss via https? |
@heha Dont think so, I'm not using https and still have these hungry memory issues... Downgrading to node v0.6.21 (last stable of v0.6) gave me some improvements on this. Will try 0.7 just in case... |
I upgraded to the latest 0.8 node and memory issues are gone - also no On Tue, Feb 19, 2013 at 8:27 AM, eveiga [email protected] wrote:
|
@nodenstuff v0.8.20? |
0.8.20 correct - complied form source on Debian 6 - and i use https - it i use redis to store my client data as well it depends on what your specific implementation is using with regard to On Tue, Feb 19, 2013 at 9:06 AM, eveiga [email protected] wrote:
|
There is a leak somewhere in either node or the wss implementation that On Tue, Feb 19, 2013 at 9:18 AM, James Stanford [email protected]:
|
Ok! Gonna give a try on 0.8.20, makes me some "itch" still using 0.6.21 just because of this issue with memory consumption. Either way I couldn't keep restarting node processes on a daily basis, it's just not maintainable! I would love to use redis to store socket information, but it just doesn't scale :( #862 Best regards! |
You are right, I don't use the socket.io redis implementation - hiredis Setting a cron/bash to restart it once a week is all I have done. Memory Let us know how your tests go and if it reduces the leaks from your app. On Tue, Feb 19, 2013 at 9:25 AM, eveiga [email protected] wrote:
|
Well, came back to starting point. Only Node.js v0.6.2 works well for me :/ It's the only version that it's not memory hungry... v0.6.21 and 0.8.20 didn't solve the problem! Either way, beside the fact that with 0.6.2 the memory consumption is uniform, I'm having @yurynix problem. |
@eveiga |
Thanks for the quick reply. Are you still on node.js 0.6? or 0.8 fits well? |
Well got back to 0.8.19, gonna give a try on sockjs... |
I have also been experiencing significant memory leaks with Socket.io and Node 0.8. I've identified the problem and submitted a fix: #1177. Hopefully it will make it into the release version soon. This memory leak will only affect you if you are using Socket.io over HTTPS (note the S!) and Node 0.8, but if you are using these two things together then it will almost certainly affect you. |
@jpallen Hopefully this will be merged on 0.9! thanks a lot |
Hello, same problem for me. I use version 0.8 node and socket.io 0.9 with SSL. Happens every day around 18:00 this error: Allocation failed - process out of memory. Do you think I should use the node with version 0.6? |
Another option to fix this memory leak is to set:
The default is 10Mb and it is these slab buffers that cause the leak. Making them smaller should help things significantly, although possibly at the risk of reducing the speed of HTTPS connections. This is only available in the most recent versions of Node (0.8.20 and 0.8.21 I think). See nodejs/node-v0.x-archive#4636 for more details. |
Hey everyone, this issue is solved with 0.9.14! |
My socket.io leaked without https, so i doubt the https fix had anything to do with my case. |
I hadn't https too, and 0.9.14 fixed! |
I been trying to find out why my simple script was leaking so much memory, my application don't have that many concurrent user and my memory would rise to 30% usage with merely 30 users connected.. Will get back with info if it fixed my memory issue.. I am not using https so lets see what happens.. |
I currently use node v0.8.23 and socket.io 0.9.14 (no https) with about 2500 concurrent connections
the client doesnt do anything just connect, noteven an event ist fired, the getstats is only used by one client (which is an company internal sats server and is only run once a second) The memory consumption improved a lot with the node and socket.io update. |
After 2 hours i have to say the memory is still going up :-( whith about 2200 connections all the time i went from 80mb to 134mb :-( |
As of a test of a whole day with same traffic, as I stated I don't have much traffic, my memory usage is day to night, start at 2.1 % grows to 3.7 during peak hour and returned to a healthy 2.5 % .. FYI the socket.io Google group is a joke right now I joined and tried to post and told me it needed moderation but it seems there isn't a moderator available. . Is there still a living person in charge of google groups? |
Good news! seems the memory just went to 200mb and now stays there, thats great! |
@utan I have access to google groups, but I can't moderate it because google groups keeps giving errors. |
@ 3rd-Eden thanks for your help.. github should have some forum group so we can come here and ask questions.. For the most part I'm only left putting questions in other forums,, |
I just downgraded version from v0.10 to v0.6.9, memory leak reduced from 24,000K to 9,000K approximately. |
Hi,
We are using 0.9.6,
We've been noticing memory usage increasing until the server stops responding.
It usually would take a few days until this happened but now we increasing usage (about 220 peers) , the server stops responding in less than one day.
Should we be destroying some objects, releasing some connection? Anything we are not doing that we should do to stop this?
Our client setup:
Our server setup:
Thanks,
Barbara
The text was updated successfully, but these errors were encountered: