socket.io over https memory leak issue

1,689 views
Skip to first unread message

milesdong

unread,
Sep 18, 2014, 11:40:15 AM9/18/14
to nod...@googlegroups.com
Hi all

We faced the memory leak probleam when we migrate our socket.io from http to https. The memory slowly growing up and at some point, CPU suddenly goes to 99% without responsive and finally coredumped by abort().

I tried to shutdown all the connections by using iptables, and find that the js heap memory did going down, but the whole process memory(get from ps aux) seems not decreased a lot.

Here is the memroy situation after i shutdown 10000 TCP ESTABLISHED connections:
------------------------------
process memory consume:
miles     31370 15.3  0.7 973188 371732 pts/7 Sl   22:35   7:08 ./bin/node --trace-gc --trace-gc-verbose --expose_gc server.js
js gc log:
[31370]  2875093 ms: Mark-sweep 9.3 (54.0) -> 9.3 (54.0) MB, 11 ms [gc extension] [GC in old space requested].
----------------------------
1. This maybe because the process does not give memory back to OS for some kind of user space memroy alloc policy or there's hole in the page
2. It's a normal memory leak from process heap(allloced by new/malloc)

Does someone have good ideas to handle this situation?

Thanks.

张大伟

unread,
Sep 22, 2014, 10:28:29 PM9/22/14
to nod...@googlegroups.com
Hi
Our team is now facing this problem, that a big memory leak, when sixteen users visit our website, the memory was rose 350 MB :(
and the version of the socket.io that we use is 0.9, which version you are using.


milesdong

unread,
Sep 24, 2014, 11:35:45 PM9/24/14
to nod...@googlegroups.com
0.9.14, Same version as yours. Memory can easily bolw up to 1.8G under 10000 connections.

greelgorke

unread,
Sep 26, 2014, 3:43:02 AM9/26/14
to nod...@googlegroups.com
i know, it might be not what you want to hear, but socket.io has had a 1.0 release, which was a bigger step and should have solved many problems ppl had with 0.9 version, so may be you want to update? i'm not sure about if the maintainer want to support the know as buggy version, you should update anyway soon.

Pablo Torres

unread,
Nov 19, 2014, 5:22:27 PM11/19/14
to nod...@googlegroups.com
My app is seeing the same problem, memory blowing up after some time and then CPU going to 100%. We've been using socket 1.x since mid August, so that doesn't solve it. Does anyone have any ideas as to what to try next?

For us, a partial fix was to make sure that we only use websockets as a transport mechanism. We are still leaking memory, but much less so than before. If websockets suit your app, the line you need to configure them is this:

io.connect(serverUrl, { transports: ['websocket'] })

I'd like to make sure I get rid of the leak completely though. Any help would be appreciated.

julien...@joyent.com

unread,
Nov 21, 2014, 1:44:29 PM11/21/14
to nod...@googlegroups.com
Hi,


On Wednesday, November 19, 2014 2:22:27 PM UTC-8, Pablo Torres wrote:
My app is seeing the same problem, memory blowing up after some time and then CPU going to 100%. We've been using socket 1.x since mid August, so that doesn't solve it. Does anyone have any ideas as to what to try next?

Pablo Torres N.

unread,
Nov 22, 2014, 11:38:38 AM11/22/14
to nod...@googlegroups.com
Oh sweet! I'll test that and report back.

~ Pablo

--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to a topic in the Google Groups "nodejs" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nodejs/KjSSExpOw6k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/796b2bc4-9c1f-422f-a611-3b0e936b5353%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Pablo Torres N.

unread,
Dec 3, 2014, 11:40:37 AM12/3/14
to nod...@googlegroups.com
My app is still leaking. However, it's unclear if the leak originally was due to socket.io or not.

~ Pablo
Reply all
Reply to author
Forward
0 new messages