Skip to content

Memory leak #25531

Description

@RootUp

Hi Team,

Summary

I have build node.js using AFL integrated ASAN in ubuntu 16.04 LTS and while executing the node program multiple memory leaks were observed, also please find attached .txt file to view full direct leak.

ASAN

Direct leak of 3240 byte(s) in 5 object(s) allocated from:
    #0 0x9ba6f0  (/home/input0/node/out/Release/node+0x9ba6f0)
    #1 0x247a471  (/home/input0/node/out/Release/node+0x247a471)
    #2 0x24840af  (/home/input0/node/out/Release/node+0x24840af)
    #3 0x2484b89  (/home/input0/node/out/Release/node+0x2484b89)
    #4 0x15ccd11  (/home/input0/node/out/Release/node+0x15ccd11)
    #5 0xd22d9c  (/home/input0/node/out/Release/node+0xd22d9c)
    #6 0x98e102  (/home/input0/node/out/Release/node+0x98e102)

Direct leak of 1296 byte(s) in 2 object(s) allocated from:
    #0 0x9ba6f0  (/home/input0/node/out/Release/node+0x9ba6f0)
    #1 0x247a471  (/home/input0/node/out/Release/node+0x247a471)
    #2 0x2429b12  (/home/input0/node/out/Release/node+0x2429b12)
    #3 0x24462a3  (/home/input0/node/out/Release/node+0x24462a3)
    #4 0x2442c88  (/home/input0/node/out/Release/node+0x2442c88)
    #5 0x241b547  (/home/input0/node/out/Release/node+0x241b547)
    #6 0x2428778  (/home/input0/node/out/Release/node+0x2428778)
    #7 0x234fb0f  (/home/input0/node/out/Release/node+0x234fb0f)
    #8 0x2351471  (/home/input0/node/out/Release/node+0x2351471)
    #9 0x2412047  (/home/input0/node/out/Release/node+0x2412047)
    #10 0x22d1c5c  (/home/input0/node/out/Release/node+0x22d1c5c)
    #11 0x22c6ac4  (/home/input0/node/out/Release/node+0x22c6ac4)
    #12 0x22bed48  (/home/input0/node/out/Release/node+0x22bed48)
    #13 0x22ed4a2  (/home/input0/node/out/Release/node+0x22ed4a2)
    #14 0x22ed5c3  (/home/input0/node/out/Release/node+0x22ed5c3)
    #15 0x2234cd7  (/home/input0/node/out/Release/node+0x2234cd7)
    #16 0x21aeb87  (/home/input0/node/out/Release/node+0x21aeb87)
    #17 0x21b84a6  (/home/input0/node/out/Release/node+0x21b84a6)
    #18 0x24abe0d  (/home/input0/node/out/Release/node+0x24abe0d)
    #19 0x24b1a39  (/home/input0/node/out/Release/node+0x24b1a39)
    #20 0x24b331d  (/home/input0/node/out/Release/node+0x24b331d)
    #21 0x24aeda6  (/home/input0/node/out/Release/node+0x24aeda6)
    #22 0x24ada0a  (/home/input0/node/out/Release/node+0x24ada0a)
    #23 0x24d2998  (/home/input0/node/out/Release/node+0x24d2998)
    #24 0x481326d  (/home/input0/node/out/Release/node+0x481326d)
    #25 0x483a5ae  (/home/input0/node/out/Release/node+0x483a5ae)
    #26 0x7e8a29f8816d  (<unknown module>)
    #27 0x7e8a29f8816d  (<unknown module>)
    #28 0x7e8a29f8816d  (<unknown module>)
    #29 0x7e8a29f8816d  (<unknown module>)

.......

SUMMARY: AddressSanitizer: 36953 byte(s) leaked in 305 allocation(s).

node.txt

Activity

  1. bnoordhuis commented on Jan 16, 2019

    @bnoordhuis
    Member

    Without symbolic names the output isn't that useful if you built from source. That said, it's not unexpected for tools like msan and valgrind to complain because Node.js doesn't free memory on exit (because what's the point - the OS reclaims it anyway.)

  2. added
    questionIssues asking questions about Node.js.
    memoryIssues and PRs related to Node.js memory management or memory footprint.
    on Jan 16, 2019
  3. addaleax commented on Jan 17, 2019

    @addaleax
    Member

    That said, it's not unexpected for tools like msan and valgrind to complain because Node.js doesn't free memory on exit (because what's the point - the OS reclaims it anyway.)

    We do a lot more cleanup since Node 10, btw, so knowing which version you’re building might also help.

    There are also 1 or 2 “valid” memory leaks in the valgrind suppression file listed in #25498, if you want to compare.

  4. RootUp commented on Jan 17, 2019

    @RootUp
    Author

    Thanks @addaleax for taking a look into this.
    I just git clone the node.js repo in this case to find above memory leaks.

  5. addaleax commented on Jan 18, 2019

    @addaleax
    Member

    @RootUp Can you provide e.g. steps to reproduce? Or, like @bnoordhuis said, symbolic names (e.g. a copy of the node binary used for this)? The .txt file is not much more than a list of random numbers on its own…

  6. RootUp commented on Jan 18, 2019

    @RootUp
    Author

    Sure.

    Steps to reproduce

    CC=afl-clang-fast CXX=afl-clang-fast++ AFL_USE_ASAN=1 ./autogen.sh
    CC=afl-clang-fast CXX=afl-clang-fast++ AFL_USE_ASAN=1 ./configure
    CC=afl-clang-fast CXX=afl-clang-fast++ AFL_USE_ASAN=1 make
    ./node
    Ctrl+C or Ctrl+D to exit from node
    
  7. bnoordhuis commented on Jan 21, 2019

    @bnoordhuis
    Member

    We don't have an autogen.sh script. Neither does the binary print that "Ctrl+C or Ctrl+D to exit" message. Where did you get your copy of node from?

  8. RootUp commented on Jan 21, 2019

    @RootUp
    Author

    Sure.

    Steps to reproduce

    CC=afl-clang-fast CXX=afl-clang-fast++ AFL_USE_ASAN=1 ./autogen.sh
    CC=afl-clang-fast CXX=afl-clang-fast++ AFL_USE_ASAN=1 ./configure
    CC=afl-clang-fast CXX=afl-clang-fast++ AFL_USE_ASAN=1 make
    ./node
    Ctrl+C or Ctrl+D to exit from node
    

    @bnoordhuis this was just an example, to reproduce the issue here are the exact steps:

    1. git clone https://github.com/nodejs/node.git
    2. cd node
    3. CC=afl-clang-fast CXX=afl-clang-fast++ AFL_USE_ASAN=1 ./configure
    4. CC=afl-clang-fast CXX=afl-clang-fast++ AFL_USE_ASAN=1 make
    5. ./node

    Once you are in node terminal press CTRL+C or CTRL+D the above memory leaks will be generated.

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

    memoryIssues and PRs related to Node.js memory management or memory footprint.questionIssues asking questions about Node.js.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions