GeezerVison is showing github.com — io.js 3.0.0 memory leak · Issue #2308 · nodejs/node
io.js 3.0.0 memory leak #2308Labels bufferIssues and PRs related to the buffer subsystem.confirmed-bugIssues and PRs for confirmed bugs.memoryIssues and PRs related to Node.js memory management or memory footprint.streamIssues and PRs related to Node.js streams. DescriptionSee Unitech/pm2#1500 for the bug report filed with PM2 before I realized it was being caused by io.js.
With io.js 2.4.0 and 2.5.0 there were no memory leaks for that module. Perhaps it could have something to do with the new Buffer implementation? Activitytrygve-lie commented on Aug 5, 2015 I've also got an app I'm test running at 3.0.0 and after 4 hours it uses the double amount of memory as it used on 2.5.0. And it seems to be climbing on 3.0.0. jbergstroem commented on Aug 5, 2015 shigeki commented on Aug 5, 2015 ofrobots commented on Aug 5, 2015 Is there a test-case that be used to reproduce the memory leak? novacrazy commented on Aug 5, 2015 Not that I can think of, unless you already have a system running PM2. Up until the server machine crashes there are no error messages or logs to track it down with. It is most certainly an issue only on io.js 3.0.0, though. I reverted back to 2.5.0 and memory usage has been stable for almost 10 hours now. rvagg commented on Aug 5, 2015 fwiw you can't assume that high memory usage and growing early memory usage are a memory leak, the way V8 handles memory and GC changes over time so you may possibly be dealing with a "normal" memory profile. It'd be good to have data for a longer run. ofrobots commented on Aug 5, 2015 Based on the original report in Unitech/pm2#1500, it seems that the growth rate is 30MB/min and the app runs out of memory in a couple of hours. This does smell like a memory leak, but It would be very hard to debug this, or to know if the memory leak is actually in io.js, without a test case that shows the problem. At the least, can you grab and compare heap-snapshots and see what kinds of objects are growing? novacrazy commented on Aug 5, 2015 Well, I changed nothing other than upgrading io.js, and tried out both old, current and pre-release versions of PM2. I even tried out bumping down my dependencies from the last time I upgraded those.
When viewed with htop, I saw 500+ MB (kept growing until the server crashed) for each process with 3.0.0, versus about 40-60MB stable per process with 2.5.0. I wouldn't call a 1000% memory increase with up to 2MB per second continuous growth at idle a "normal" curve.
Perhaps it is completely normal if the bug is in PM2 instead, and previous versions' GC still managed to collect it somehow while 3.0.0 doesn't. My actual application code and processes seems unaffected; only the PM2 processes have such high memory usage. The PM2 processes also handle all the cluster and load balancing stuff, which could be more affected by the new Buffer implementation than my code is. I honestly don't know, but I'm willing to give you any data I can possibly provide. jbergstroem commented on Aug 5, 2015 To people experiencing the same issue: The best way to drive this issue forward is more metrics over time and a reduced proof of concept we all can test. novacrazy commented on Aug 5, 2015 I'm sorry, but I honestly have no idea how to take a heap snapshot of the individual PM2 daemons. jbergstroem commented on Aug 5, 2015 novacrazy commented on Aug 5, 2015 Alright, I injected require('heapdump'); into Common.js so all the daemons should have it. Now I just need to wait a bit for things to accumulate and for my rural internet connection to download the files. I'll post the (probably massive) results in a little while. ofrobots commented on Aug 5, 2015 Before you upload the heapdump, be aware that it contains the full JavaScript heap and may include private information (such as user data, keys, etc.) and the source code of your JavaScript functions. novacrazy commented on Aug 5, 2015 bnoordhuis commented on Aug 5, 2015 I just closed out a similar issue 30 seconds ago. :-)
I don't think that's an issue with node-heapdump but with V8. It's a C++11 project and you'll need at least gcc 4.8 or clang 3.4. You could get away with older versions until now but no more. silverwind commented on Aug 17, 2015 While the major leak will be fixed in the upcoming 3.1.0, I think there's still a few minor leaks around. Please post test cases if you have any! rvagg commented on Aug 18, 2015 ChALkeR commented on Aug 18, 2015 @rvagg
the https test is showing a possible very slow leak
Just in case: could you confirm that there is no mistype? The 3.0.1 memory usage on your graph looks constant with https-ping (the bottom one) and very slightly growing over time with http-ping (the upper one) to me. rvagg commented on Aug 18, 2015 @ChALkeR sorry, you're absolutely correct, it's the http-ping that appears to be leaking while https-ping is stable, which is very strange!
http-ping stabilises at around 75k and then gradually, but steadily, adds 10k more by the end of the graph.
https-ping fluctuates between 71k and 72k for the entire length. rvagg commented on Aug 18, 2015 kzc commented on Aug 18, 2015
it's the http-ping that appears to be leaking while https-ping is stable
http-ping has reached steady state in the last 6 hours.
It's probably just memory arena fragmentation or the new v8 engine performing GC less aggressively in this low memory test. It appears to have levelled off.
@rvagg - can you provide a link to your RSS ping test source code? silverwind commented on Aug 18, 2015 rvagg commented on Aug 18, 2015 rvagg commented on Aug 19, 2015 
Memory usage settled right down to stable in 3.0.1 (nightly), so call off the dogs on that one. silverwind commented on Aug 20, 2015 I'll close this one per the graph above. We don't have any more indicators for more major leaks like the one in 3.0.0.
MetadataMetadatabufferIssues and PRs related to the buffer subsystem.confirmed-bugIssues and PRs for confirmed bugs.memoryIssues and PRs related to Node.js memory management or memory footprint.streamIssues and PRs related to Node.js streams. DevelopmentNo branches or pull requestsIssue actions
|