nebula-cpp icon indicating copy to clipboard operation
nebula-cpp copied to clipboard

Memory leak in some conditions.

Open Shylock-Hg opened this issue 4 years ago • 1 comments

➜  build git:(fix/asan) ✗ ./bin/test/connection_test
[==========] Running 6 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 6 tests from ConnectionTest
[ RUN      ] ConnectionTest.Basic
I1215 17:46:28.031438 36440 ConnectionTest.cpp:120] Testing once.
E1215 17:46:28.031808 36440 Connection.cpp:217] Ping failed: Not open connection.
E1215 17:46:29.054208 36440 Connection.cpp:217] Ping failed: Not open connection.
E1215 17:46:29.054322 36440 Connection.cpp:217] Ping failed: Not open connection.
I1215 17:46:29.054392 36440 ConnectionTest.cpp:122] Testing reopen.
E1215 17:46:29.054426 36440 Connection.cpp:217] Ping failed: Not open connection.
E1215 17:46:30.066576 36440 Connection.cpp:217] Ping failed: Not open connection.
E1215 17:46:30.066687 36440 Connection.cpp:217] Ping failed: Not open connection.
[       OK ] ConnectionTest.Basic (2037 ms)
[ RUN      ] ConnectionTest.Timeout
[       OK ] ConnectionTest.Timeout (30142 ms)
[ RUN      ] ConnectionTest.SSL
[       OK ] ConnectionTest.SSL (14 ms)
[ RUN      ] ConnectionTest.JsonResult
[       OK ] ConnectionTest.JsonResult (5 ms)
[ RUN      ] ConnectionTest.InvalidPort
E1215 17:47:00.229737 36440 Connection.cpp:120] Failed to verify client version: Channel is !good()
[       OK ] ConnectionTest.InvalidPort (2 ms)
[ RUN      ] ConnectionTest.InvalidHost
E1215 17:47:00.233917 36440 Connection.cpp:86] Invalid address: Invalid Host:9669: Failed to resolve address for 'Invalid Host': Name or service not known (error=-2): Unknown error -2
[       OK ] ConnectionTest.InvalidHost (4 ms)
[----------] 6 tests from ConnectionTest (32204 ms total)

[----------] Global test environment tear-down
[==========] 6 tests from 1 test case ran. (32204 ms total)
[  PASSED  ] 6 tests.

=================================================================
==36440==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 944 byte(s) in 1 object(s) allocated from:
    #0 0xa4d867 in operator new(unsigned long) /usr/src/nebula-package/toolset-build/source/llvm-10.0.0/projects/compiler-rt/lib/asan/asan_new_delete.cpp:99:3
    #1 0x10c80f6 in folly::AsyncSocket::newSocket(folly::EventBase*, folly::SocketAddress const&, unsigned int, bool) /home/shylock.huang/local/vesoft/2.0/third-party/include/folly/io/async/AsyncSocket.h:364:9
    #2 0x10c7946 in nebula::Connection::open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, unsigned int, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)::$_0::operator()() const /home/shylock.huang/nebula-cpp2/src/client/Connection.cpp:97:22
    #3 0x10c7094 in void folly::detail::function::FunctionTraits<void ()>::callBig<nebula::Connection::open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, unsigned int, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)::$_0>(folly::detail::function::Data&) /home/shylock.huang/local/vesoft/2.0/third-party/include/folly/Function.h:385:7
    #4 0x145abf1  (/home/shylock.huang/nebula-cpp2/build/bin/test/connection_test+0x145abf1)
    #5 0x17be1df1c23ee  (<unknown module>)

SUMMARY: AddressSanitizer: 944 byte(s) leaked in 1 allocation(s).

Shylock-Hg avatar Dec 15 '21 09:12 Shylock-Hg

Probabilistically occurs in #76

Shylock-Hg avatar Dec 15 '21 09:12 Shylock-Hg