Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-8194

Fix ASAN leaks when tcmalloc is enabled

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: WT10.0.1
    • Component/s: None
    • Labels:
      None
    • Story Points:
      2
    • Sprint:
      Storage - Ra 2021-10-18, Storage - Ra 2021-11-01

      Description

      In WT-7885, A patch build with tcmalloc enabled caused a few address sanitiser errors to appear. 

      The ASAN leak errors are:
      csuite-wt4156-metadata-salvage-test

      [2021/10/01 00:17:19.647] ASAN_OPTIONS="detect_leaks=1:abort_on_error=1:disable_coredump=0" ASAN_SYMBOLIZER_PATH=/opt/mongodbtoolchain/v3/bin/llvm-symbolizer TESTUTIL_BYPASS_ASAN=1 LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libeatmydata.so PATH=/opt/mongodbtoolchain/v3/bin:$PATH LD_LIBRARY_PATH=$(pwd)/.libs:$(git rev-parse --show-toplevel)/TCMALLOC_LIB/lib top_srcdir=$(pwd)/.. top_builddir=$(pwd) $(pwd)/test/csuite/test_wt4156_metadata_salvage 2>&1
       [2021/10/01 00:17:19.660] =================================================================
       [2021/10/01 00:17:19.660] ==123169==ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0x000002b0e008 in thread T0
       [2021/10/01 00:17:20.219]     #0 0x4c52e2 in free /data/mci/2a834e5406da55eb2b59da6bbcfb3e78/toolchain-builder/tmp/build-llvm.sh-qkG/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:124:3
       [2021/10/01 00:17:20.220]     #1 0x4fb300 in testutil_is_flag_set /data/mci/bc3ffe86a1d6d4d5ad918cf20559ef22/wiredtiger/build_posix/test/utility/../../../test/utility/misc.c:330:5
       [2021/10/01 00:17:20.220]     #2 0x4f4ad9 in main /data/mci/bc3ffe86a1d6d4d5ad918cf20559ef22/wiredtiger/build_posix/test/csuite/../../../test/csuite/wt4156_metadata_salvage/main.c:447:9
       [2021/10/01 00:17:20.226]     #3 0x7f98995980b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
       [2021/10/01 00:17:20.226]     #4 0x41d81d in _start (/data/mci/a0cfbad6727adcc2b03aaef77cc8663b/wiredtiger/build_posix/test/csuite/test_wt4156_metadata_salvage+0x41d81d)
       [2021/10/01 00:17:20.226] Address 0x000002b0e008 is a wild pointer.
       [2021/10/01 00:17:20.226] SUMMARY: AddressSanitizer: bad-free /data/mci/2a834e5406da55eb2b59da6bbcfb3e78/toolchain-builder/tmp/build-llvm.sh-qkG/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:124:3 in free
       [2021/10/01 00:17:20.445] ==123169==ABORTING
       [2021/10/01 00:17:20.445] Aborted (core dumped)
      

      cppsuite-base-test-default

       [2021/10/01 00:17:53.767] =================================================================
       [2021/10/01 00:17:53.767] ==22634==ERROR: LeakSanitizer: detected memory leaks
       [2021/10/01 00:17:53.768] Direct leak of 8 byte(s) in 1 object(s) allocated from:
       [2021/10/01 00:17:53.768]     #0 0x556452 in operator new(unsigned long) /data/mci/2a834e5406da55eb2b59da6bbcfb3e78/toolchain-builder/tmp/build-llvm.sh-qkG/llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:106:3
       [2021/10/01 00:17:53.768]     #1 0x7f97c2e2dedd in InitModule() (.part.0) /data/mci/afa8fdbfb065318fbea1329dcac62de0/wiredtiger/gperftools-2.9.1/src/malloc_extension.cc:212:26
       [2021/10/01 00:17:56.071] SUMMARY: AddressSanitizer: 8 byte(s) leaked in 1 allocation(s).
       [2021/10/01 00:17:56.071] Aborted (core dumped)
       [2021/10/01 00:17:56.074] Command failed: command encountered problem: error waiting on process 'e508fa74-0dd8-47ca-b4e7-34aa9b5dfb7a': exit status 134
      

      cppsuite-hs-cleanup-default

       [2021/10/01 00:18:10.831] =================================================================
       [2021/10/01 00:18:10.832] ==4696==ERROR: LeakSanitizer: detected memory leaks
       [2021/10/01 00:18:10.832] Direct leak of 8 byte(s) in 1 object(s) allocated from:
       [2021/10/01 00:18:10.832]     #0 0x556452 in operator new(unsigned long) /data/mci/2a834e5406da55eb2b59da6bbcfb3e78/toolchain-builder/tmp/build-llvm.sh-qkG/llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:106:3
       [2021/10/01 00:18:10.832]     #1 0x7fd75bb0fedd in InitModule() (.part.0) /data/mci/afa8fdbfb065318fbea1329dcac62de0/wiredtiger/gperftools-2.9.1/src/malloc_extension.cc:212:26
       [2021/10/01 00:18:23.730] SUMMARY: AddressSanitizer: 8 byte(s) leaked in 1 allocation(s).
       [2021/10/01 00:18:23.730] Aborted (core dumped)
       [2021/10/01 00:18:23.733] Command failed: command encountered problem: error waiting on process '21c8a557-f7df-44cc-9ae1-ca10a3c87996': exit status 134
      

      Definition of done:
      This ticket will need to fix the ASAN leaks when tcmalloc is enabled. After fixing the leaks, configure the evergreen yaml file to enable tcmalloc for ubuntu2004-asan variant task
      This is the changes of enabling tcmalloc.

      - name: ubuntu2004-asan
        display_name: "! Ubuntu 20.04 ASAN"
        run_on:
        - ubuntu2004-test
        expansions:
          configure_env_vars:
            CC=/opt/mongodbtoolchain/v3/bin/clang
            CXX=/opt/mongodbtoolchain/v3/bin/clang++
            PATH=/opt/mongodbtoolchain/v3/bin:$PATH
            CFLAGS="-fsanitize=address -fno-omit-frame-pointer -ggdb"
            CXXFLAGS="-fsanitize=address -fno-omit-frame-pointer -ggdb"
          posix_configure_flags:
            --enable-silent-rules
            --enable-strict
            --enable-diagnostic
            --disable-static
            --enable-tcmalloc
            --prefix=$(pwd)/LOCAL_INSTALL
          smp_command: -j $(grep -c ^processor /proc/cpuinfo)
          make_command: PATH=/opt/mongodbtoolchain/v3/bin:$PATH make
          test_env_vars:
            ASAN_OPTIONS="detect_leaks=1:abort_on_error=1:disable_coredump=0"
            ASAN_SYMBOLIZER_PATH=/opt/mongodbtoolchain/v3/bin/llvm-symbolizer
            TESTUTIL_BYPASS_ASAN=1
            LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libeatmydata.so 
            PATH=/opt/mongodbtoolchain/v3/bin:$PATH
            LD_LIBRARY_PATH=$(pwd)/.libs:$(git rev-parse --show-toplevel)/TCMALLOC_LIB/lib
            top_srcdir=$(pwd)/..
            top_builddir=$(pwd)
        tasks:
          - name: ".pull_request !.windows_only !.pull_request_compilers !.python"
          - name: examples-c-test
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jie.chen Jie Chen
              Reporter:
              jie.chen Jie Chen
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: