GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — io.js 3.0.0 memory leak · Issue #2308 · nodejs/node

io.js 3.0.0 memory leak #2308

New issue
Copy link
New issue
Copy link
Closed
Closed
io.js 3.0.0 memory leak#2308
Copy link
Labels
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.

Description

@novacrazy
novacrazy
opened on Aug 5, 2015
Issue body actions

See 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?

Activity

Next
  1. trygve-lie commented on Aug 5, 2015

    @trygve-lie
    trygve-lie
    on Aug 5, 2015
    More actions

    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.

  2. jbergstroem commented on Aug 5, 2015

    @jbergstroem
    jbergstroem
    on Aug 5, 2015
    Member
    More actions

    Perhaps @ChALkeR, @shigeki or @jasisk could do some testing?

  3. shigeki commented on Aug 5, 2015

    @shigeki
    shigeki
    on Aug 5, 2015
    Contributor
    More actions

    @jbergstroem Sorry, I'm just getting on board to SFO now.

  4. ofrobots commented on Aug 5, 2015

    @ofrobots
    ofrobots
    on Aug 5, 2015
    Contributor
    More actions

    Is there a test-case that be used to reproduce the memory leak?

  5. novacrazy commented on Aug 5, 2015

    @novacrazy
    novacrazy
    on Aug 5, 2015
    Author
    More actions

    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.

  6. rvagg commented on Aug 5, 2015

    @rvagg
    rvagg
    on Aug 5, 2015
    Member
    More actions

    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.

  7. ofrobots commented on Aug 5, 2015

    @ofrobots
    ofrobots
    on Aug 5, 2015
    Contributor
    More actions

    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?

  8. novacrazy commented on Aug 5, 2015

    @novacrazy
    novacrazy
    on Aug 5, 2015
    Author
    More actions

    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.

  9. jbergstroem commented on Aug 5, 2015

    @jbergstroem
    jbergstroem
    on Aug 5, 2015
    Member
    More actions

    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.

  10. novacrazy commented on Aug 5, 2015

    @novacrazy
    novacrazy
    on Aug 5, 2015
    Author
    More actions

    I'm sorry, but I honestly have no idea how to take a heap snapshot of the individual PM2 daemons.

  11. jbergstroem commented on Aug 5, 2015

    @jbergstroem
    jbergstroem
    on Aug 5, 2015
    Member
    More actions

    @novacrazy try importing heapdump and send it a unix signal.

  12. novacrazy commented on Aug 5, 2015

    @novacrazy
    novacrazy
    on Aug 5, 2015
    Author
    More actions

    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.

  13. ofrobots commented on Aug 5, 2015

    @ofrobots
    ofrobots
    on Aug 5, 2015
    Contributor
    More actions

    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.

  14. novacrazy commented on Aug 5, 2015

    @novacrazy
    novacrazy
    on Aug 5, 2015
    Author
    More actions

    @ofrobots Very good advice, thank you.

    Also, @bnoordhuis, heapdump fails to compile with io.js 3.0.0: http://pastebin.com/RVnY5Mrs

    Not sure if that is my fault or part of the last V8 upgrade.

  15. bnoordhuis commented on Aug 5, 2015

    @bnoordhuis
    bnoordhuis
    on Aug 5, 2015
    Member
    More actions

    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.

  16. 64 remaining items

  17. ChALkeR
    added
    memoryIssues and PRs related to Node.js memory management or memory footprint.
    on Aug 17, 2015
  18. silverwind commented on Aug 17, 2015

    @silverwind
    silverwind
    on Aug 17, 2015
    Contributor
    More actions

    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!

  19. rvagg commented on Aug 18, 2015

    @rvagg
    rvagg
    on Aug 18, 2015
    Member
    More actions

    screen shot 2015-08-18 at 5 33 19 pm

    Current master (actually https://iojs.org/download/nightly/v3.0.1-nightly201508173645dc62ed/) looks pretty good, the https test is showing a possible very slow leak, it's creeping up really slowly but I'm not confident calling it a leak. Will leave it going and see what happens but the main leak(s) appear to be resolved.

  20. ChALkeR commented on Aug 18, 2015

    @ChALkeR
    ChALkeR
    on Aug 18, 2015
    Member
    More actions

    @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.

  21. rvagg commented on Aug 18, 2015

    @rvagg
    rvagg
    on Aug 18, 2015
    Member
    More actions

    @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.

  22. rvagg commented on Aug 18, 2015

    @rvagg
    rvagg
    on Aug 18, 2015
    Member
    More actions

    @ChALkeR http://128.199.216.28:3000/dashboard/db/memory-tests

  23. kzc commented on Aug 18, 2015

    @kzc
    kzc
    on Aug 18, 2015
    More actions

    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?

  24. silverwind commented on Aug 18, 2015

    @silverwind
    silverwind
    on Aug 18, 2015
    Contributor
    More actions

    @kzc see #2423

    On a sidenote, my test case with FormData was just invalidated, the issue seems to have been a unconsumed stream (https://gist.github.com/silverwind/54b3829142f93d1127bc#gistcomment-1552967)

  25. rvagg commented on Aug 18, 2015

    @rvagg
    rvagg
    on Aug 18, 2015
    Member
    More actions

    ditto, and see https://github.com/rvagg/node-memtest/tree/master/test directly for source of the tests, rss is collected using ps so it works on osx and linux: https://github.com/rvagg/node-memtest/blob/master/memtest.sh#L50

  26. rvagg commented on Aug 19, 2015

    @rvagg
    rvagg
    on Aug 19, 2015
    Member
    More actions

    screen shot 2015-08-20 at 9 05 17 am

    Memory usage settled right down to stable in 3.0.1 (nightly), so call off the dogs on that one.

  27. silverwind commented on Aug 20, 2015

    @silverwind
    silverwind
    on Aug 20, 2015
    Contributor
    More actions

    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.

  28. silverwind
    closed this as completedon Aug 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    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.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.