scylladb / seastar

High performance server-side application framework
http://seastar.io
Apache License 2.0
8.39k stars 1.55k forks source link

memory leak when run some test cases #424

Open bwlee opened 6 years ago

bwlee commented 6 years ago

All these memory leaks reports same size but without location info, it seemed the leak lies in class reactor, not family with it, tried but failed to find it.

for example:

bwl@ubuntu-dev:~/test/seastar$ build/debug/tests/rpc_test

WARN 2018-03-31 17:07:48,768 seastar - Seastar compiled with default allocator, heap profiler not supported WARN 2018-03-31 17:07:48,775 seastar - Seastar compiled with default allocator, heap profiler not supported WARN 2018-03-31 17:07:48,797 [shard 0] seastar - Unable to set SCHED_FIFO scheduling policy for timer thread; latency impact possible. Try adding CAP_SYS_NICE ==22593==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!

*** No errors detected

================================================================= ==22593==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 176 byte(s) in 2 object(s) allocated from:

0 0x7f86aae22920 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xde920)

#1 0x7f86a4f184a8 in lt__malloc (/usr/lib/x86_64-linux-gnu/libltdl.so.7+0x24a8)

SUMMARY: AddressSanitizer: 176 byte(s) leaked in 2 allocation(s).

ENV: bwl@ubuntu-dev:~/test/seastar$ uname -a Linux ubuntu-dev 4.4.0-116-generic #140-Ubuntu SMP Mon Feb 12 21:23:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Binutils and libraries: Boost 1.66, Gcc-7, protobuf-dev: 3.5.1

Another found issue is in fsqual.cc, missing a free().

--- a/core/fsqual.cc +++ b/core/fsqual.cc @@ -87,6 +87,7 @@ bool filesystem_has_good_aio_support(sstring directory, bool verbose) { throw_kernel_error(long(ioev.res)); assert(long(ioev.res) == bufsize); }

// FIXED by adding:

  • free(buf);
 auto rate = float(ctxsw) / nr;
 bool ok = rate < 0.1;
 if (verbose) {
avikivity commented 6 years ago

Please send patches to the mailing list.

By default, the tests are built without debug information. Try building with debug information (add _g to the executable file name) and retry.

xiaoming-qxm commented 5 years ago

Please send patches to the mailing list.

By default, the tests are built without debug information. Try building with debug information (add _g to the executable file name) and retry.

@avikivity I got the same memory leaks(176 bytes) when using debug mode in current master branch, is there any solution to fix this?

mikhail-barg commented 3 years ago

Still actual with current master.

user@machine:/seastar/build/debug/demos $ ASAN_SYMBOLIZER_PATH=$HOME/install-clang/bin/llvm-symbolizer ./coroutines_demo
WARNING: debug mode. Not for benchmarking or production
this is a completely useless program
please stand by...
1
2
3
4
5
6
7
8
9
10
done

=================================================================
==4817==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 176 byte(s) in 2 object(s) allocated from:
    #0 0x4acb2d in malloc /home/user/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:145:3
    #1 0x7fb7dbfe94a8 in lt__malloc (/usr/lib/x86_64-linux-gnu/libltdl.so.7+0x24a8)

SUMMARY: AddressSanitizer: 176 byte(s) leaked in 2 allocation(s).