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 #25531

Closed
RootUp opened this issue Jan 16, 2019 · 7 comments
Closed

Memory leak #25531

RootUp opened this issue Jan 16, 2019 · 7 comments
Labels
memory Issues and PRs related to the memory management or memory footprint. question Issues that look for answers.

Comments

@RootUp
Copy link

RootUp commented Jan 16, 2019

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

@bnoordhuis
Copy link
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.)

@bnoordhuis bnoordhuis added question Issues that look for answers. memory Issues and PRs related to the memory management or memory footprint. labels Jan 16, 2019
@addaleax
Copy link
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.

@RootUp
Copy link
Author

RootUp commented Jan 17, 2019

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

@addaleax
Copy link
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…

@RootUp
Copy link
Author

RootUp commented Jan 18, 2019

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
Copy link
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?

@RootUp
Copy link
Author

RootUp commented Jan 21, 2019

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.

@RootUp RootUp closed this as completed Jan 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
memory Issues and PRs related to the memory management or memory footprint. question Issues that look for answers.
Projects
None yet
Development

No branches or pull requests

3 participants