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 on Node v0.10 #35

Open
clowwindy opened this issue Mar 30, 2013 · 19 comments
Open

memory leak on Node v0.10 #35

clowwindy opened this issue Mar 30, 2013 · 19 comments
Assignees

Comments

@clowwindy
Copy link
Contributor

No description provided.

@ghost ghost assigned clowwindy Mar 30, 2013
@dallascao
Copy link

The newest version 0.10.2 works fine with me. 0.6.0 is not. with 0.6.0, CPU usage shoots to 100% and the thread exits unexpectedly quite often.

@zhuzhuor
Copy link

Might this be the reason for the mem leak?

In versions of node prior to v0.10, the incoming message data would be simply discarded. However, in Node v0.10 and beyond, the socket will remain paused forever.

More info is at http://nodejs.org/api/stream.html#stream_compatibility

@clowwindy
Copy link
Contributor Author

@zhuzhuor No, it isn't.

@dallascao
Copy link

node v0.10.4 shadowsocks 0.10 dev
Received an warning message when running. But it continues to work fine.

(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at Socket.EventEmitter.addListener (events.js:160:15)
    at Socket.Readable.on (_stream_readable.js:653:33)
    at Socket.EventEmitter.once (events.js:179:8)
    at Socket.destroySoon (net.js:413:10)
    at Socket.onSocketEnd (net.js:261:10)
    at Socket.EventEmitter.emit (events.js:92:17)
    at TCP.onread (net.js:535:10)

@clowwindy
Copy link
Contributor Author

Used as proxy for xunlei for several hours and memory footprint starts to go up.

$ ps aux|grep node
1000     29425  0.0 28.5 353452 292848 ?       Sl   Jun03   5:20 node server.js

$ node -v
v0.10.2

I'll check tomorrow after timeout 600s went out.

@clowwindy
Copy link
Contributor Author

Forcing gc() every few seconds seems help. c4ca466

@clowwindy
Copy link
Contributor Author

Other possible causes:

  • pause() is not working in 0.10
  • write() buffer is too large?

It seems that inbound traffic is always a bit higher than outbound traffic.

if_venet0-day

@clowwindy
Copy link
Contributor Author

if_venet0-pinpoint 1375086309 1375194309

@clowwindy
Copy link
Contributor Author

Found a problem with crypto module nodejs/node-v0.x-archive#5949

@regou
Copy link

regou commented May 11, 2014

Is it resolved now? can I update node to v0.10?

@JiaJiaJiang
Copy link

迅雷不是Thunder吗。。。

@ebraminio
Copy link

Is this fixed on upgrade to 0.12 or iojs? From this "We have the new TLSWrap mechanism under the hood, this eliminates quite a few of the hops back and forth between JavaScript and our C++ implementations." so this would make the nodejs port at least faster I'd guess.

IMHO this is not a leak, at least what you've linked on nodejs/node-v0.x-archive#5949. Despite this comment from one of top node hackers, from my own experience such greedy memory consumption is common also to Java. I guess node will do better GC job when system is really under memory pressure but otherwise, it will eat as much as it can, just like what Java do for decreasing overhead of OS malloc.

@clowwindy
Copy link
Contributor Author

@ebraminio
I have already abandoned this project. No matter this is a leak or not, I can not solve it. I have been debugging node and V8 source for several weeks without any progress.

Now I'm happy with Shadowsocks Python project. I can handle 10K connections with < 100MB RSS without having to think about GC.

@yaleh
Copy link

yaleh commented Feb 9, 2015

I'm working on a new version of shdowsocks-gui now. But I haven't touch shadowsocks-nodejs yet. If there's anybody who want to fork this project and keep working on it, I'd like integrate it into my shadowsocks-gui fork.

@zuohuadong
Copy link

nodejs 9.x ?

@chenshaoju
Copy link
Contributor

This project has abandoned.

@ehsan2003
Copy link

nodejs now is on version 16.
anyone tested it these days?

@imcotton
Copy link

imcotton commented Nov 27, 2022

To complete the story, this is likely a backpressure related issue in earlier version of Streams, readable.pipe and stream.pipeline has been provided since v9 and v10 to free user from manual labor, and it's quite reliable nowadays.

@FishOrBear
Copy link

            node_args: ["--max_old_space_size=64", "--max_semi_space_size=2"],
            env: {
                "LD_PRELOAD": "/usr/lib/x86_64-linux-gnu/libjemalloc.so.2"
            },

Using this parameter solves the memory problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests