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

Fix memory leaks in tiered storage code

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None

      Running the tiered python tests under ASAN reports several memory leaks.  

      To reproduce, build WT with ASAN and run: python3 ../test/suite/run.py --asan tiered.

      Here is the relevant ASAN output:

      Direct leak of 117466 byte(s) in 111 object(s) allocated from:
          #0 0x7f0132571f83 in malloc /data/mci/f6a3cdb8925fada697dec19875e037b4/toolchain-builder/tmp/build-llvm.sh-cpH/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:146:3
          #1 0x7f012a9ab29e in __wt_malloc /data/wiredtiger/build_posix/../src/os_common/os_alloc.c:81:14
          #2 0x7f012a9accaf in __wt_strndup /data/wiredtiger/build_posix/../src/os_common/os_alloc.c:264:5
          #3 0x7f012a9909c0 in __wt_strdup /data/wiredtiger/build_posix/../src/include/misc_inline.h:49:13
          #4 0x7f012a98d4ed in __wt_metadata_search /data/wiredtiger/build_posix/../src/meta/meta_table.c:329:5
          #5 0x7f012a6b9cf4 in __tier_flush_meta /data/wiredtiger/build_posix/../src/conn/conn_tiered.c:195:5
          #6 0x7f012a6b9662 in __wt_tier_do_flush /data/wiredtiger/build_posix/../src/conn/conn_tiered.c:240:5
          #7 0x7f012a6bac3c in __wt_tier_flush /data/wiredtiger/build_posix/../src/conn/conn_tiered.c:266:5
          #8 0x7f012a6c0e60 in __tier_storage_copy /data/wiredtiger/build_posix/../src/conn/conn_tiered.c:296:9
          #9 0x7f012a6bee34 in __tiered_server /data/wiredtiger/build_posix/../src/conn/conn_tiered.c:482:13
          #10 0x7f01313142dd in start_thread (/lib64/libpthread.so.0+0x82dd)
      
      
      Direct leak of 74 byte(s) in 12 object(s) allocated from:
          #0 0x7f0132571f83 in malloc /data/mci/f6a3cdb8925fada697dec19875e037b4/toolchain-builder/tmp/build-llvm.sh-cpH/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:146:3
          #1 0x7f012a9ab29e in __wt_malloc /data/wiredtiger/build_posix/../src/os_common/os_alloc.c:81:14
          #2 0x7f012a9accaf in __wt_strndup /data/wiredtiger/build_posix/../src/os_common/os_alloc.c:264:5
          #3 0x7f012abcce49 in __wt_tiered_bucket_config /data/wiredtiger/build_posix/../src/tiered/tiered_config.c:117:5
          #4 0x7f012abce949 in __wt_tiered_conn_config /data/wiredtiger/build_posix/../src/tiered/tiered_config.c:157:9
          #5 0x7f012a638cdd in wiredtiger_open /data/wiredtiger/build_posix/../src/conn/conn_api.c:2823:5
          #6 0x7f012b0351a0 in _wrap_wiredtiger_open /data/wiredtiger/lang/python/wiredtiger_wrap.c:8864:16
      
      
      Direct leak of 10 byte(s) in 1 object(s) allocated from:
          #0 0x7f0132571f83 in malloc /data/mci/f6a3cdb8925fada697dec19875e037b4/toolchain-builder/tmp/build-llvm.sh-cpH/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:146:3
          #1 0x7f012a9ab29e in __wt_malloc /data/wiredtiger/build_posix/../src/os_common/os_alloc.c:81:14
          #2 0x7f012a9accaf in __wt_strndup /data/wiredtiger/build_posix/../src/os_common/os_alloc.c:264:5
          #3 0x7f012abcce49 in __wt_tiered_bucket_config /data/wiredtiger/build_posix/../src/tiered/tiered_config.c:117:5
          #4 0x7f012abd23e7 in __tiered_open /data/wiredtiger/build_posix/../src/tiered/tiered_handle.c:525:9
          #5 0x7f012abd16ad in __wt_tiered_open /data/wiredtiger/build_posix/../src/tiered/tiered_handle.c:598:5
          #6 0x7f012a684335 in __wt_conn_dhandle_open /data/wiredtiger/build_posix/../src/conn/conn_dhandle.c:579:9
          #7 0x7f012ab53698 in __wt_session_get_dhandle /data/wiredtiger/build_posix/../src/session/session_dhandle.c:510:20
          #8 0x7f012aab2985 in __schema_get_tiered_uri /data/wiredtiger/build_posix/../src/schema/schema_list.c:24:5
          #9 0x7f012aab28c5 in __wt_schema_get_tiered_uri /data/wiredtiger/build_posix/../src/schema/schema_list.c:40:5
          #10 0x7f012aaab8ee in __create_tiered /data/wiredtiger/build_posix/../src/schema/schema_create.c:878:5
          #11 0x7f012aaa43b8 in __schema_create /data/wiredtiger/build_posix/../src/schema/schema_create.c:965:15
          #12 0x7f012aaa384e in __wt_schema_create /data/wiredtiger/build_posix/../src/schema/schema_create.c:990:11
          #13 0x7f012aaa5a22 in __create_colgroup /data/wiredtiger/build_posix/../src/schema/schema_create.c:410:5
          #14 0x7f012aaaa8f5 in __create_table /data/wiredtiger/build_posix/../src/schema/schema_create.c:779:13
          #15 0x7f012aaa4256 in __schema_create /data/wiredtiger/build_posix/../src/schema/schema_create.c:961:15
          #16 0x7f012aaa384e in __wt_schema_create /data/wiredtiger/build_posix/../src/schema/schema_create.c:990:11
          #17 0x7f012aaec097 in __wt_session_create /data/wiredtiger/build_posix/../src/session/session_api.c:710:5
          #18 0x7f012aafdd01 in __session_create /data/wiredtiger/build_posix/../src/session/session_api.c:753:11
          #19 0x7f012b03782c in _wrap_Session_create /data/wiredtiger/lang/python/wiredtiger_wrap.c:6050:16
      
      
      Indirect leak of 23 byte(s) in 2 object(s) allocated from:
          #0 0x7f0132571f83 in malloc /data/mci/f6a3cdb8925fada697dec19875e037b4/toolchain-builder/tmp/build-llvm.sh-cpH/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:146:3
          #1 0x7f01324ddb52 in strndup /data/mci/f6a3cdb8925fada697dec19875e037b4/toolchain-builder/tmp/build-llvm.sh-cpH/llvm/projects/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:381:3
          #2 0x7f012893549f  (<unknown module>)
          #3 0x7f01289342ed  (<unknown module>)
          #4 0x7f012b02e0de in __wt_storage_source__ss_customize_file_system /data/wiredtiger/lang/python/wiredtiger_wrap.c:3810:17
          #5 0x7f012b02e0de in _wrap_StorageSource_ss_customize_file_system /data/wiredtiger/lang/python/wiredtiger_wrap.c:10727:16
      
      
      Indirect leak of 21 byte(s) in 2 object(s) allocated from:
          #0 0x7f0132571f83 in malloc /data/mci/f6a3cdb8925fada697dec19875e037b4/toolchain-builder/tmp/build-llvm.sh-cpH/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:146:3
          #1 0x7f01324ddb52 in strndup /data/mci/f6a3cdb8925fada697dec19875e037b4/toolchain-builder/tmp/build-llvm.sh-cpH/llvm/projects/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:381:3
          #2 0x7f012893549f  (<unknown module>)
          #3 0x7f01289340d5  (<unknown module>)
          #4 0x7f012b02e0de in __wt_storage_source__ss_customize_file_system /data/wiredtiger/lang/python/wiredtiger_wrap.c:3810:17
          #5 0x7f012b02e0de in _wrap_StorageSource_ss_customize_file_system /data/wiredtiger/lang/python/wiredtiger_wrap.c:10727:16
      
      
      Indirect leak of 11 byte(s) in 1 object(s) allocated from:
          #0 0x7f013255cc2d in __interceptor_strdup /data/mci/f6a3cdb8925fada697dec19875e037b4/toolchain-builder/tmp/build-llvm.sh-cpH/llvm/projects/compiler-rt/lib/asan/asan_interceptors.cc:447:3
          #1 0x7f0128c63034  (<unknown module>)
          #2 0x7f012abcd018 in __wt_tiered_bucket_config /data/wiredtiger/build_posix/../src/tiered/tiered_config.c:120:5
          #3 0x7f012abce949 in __wt_tiered_conn_config /data/wiredtiger/build_posix/../src/tiered/tiered_config.c:157:9
          #4 0x7f012a638cdd in wiredtiger_open /data/wiredtiger/build_posix/../src/conn/conn_api.c:2823:5
          #5 0x7f012b0351a0 in _wrap_wiredtiger_open /data/wiredtiger/lang/python/wiredtiger_wrap.c:8864:16
      
      
      Indirect leak of 9 byte(s) in 1 object(s) allocated from:
          #0 0x7f0132571f83 in malloc /data/mci/f6a3cdb8925fada697dec19875e037b4/toolchain-builder/tmp/build-llvm.sh-cpH/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:146:3
          #1 0x7f01324ddb52 in strndup /data/mci/f6a3cdb8925fada697dec19875e037b4/toolchain-builder/tmp/build-llvm.sh-cpH/llvm/projects/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:381:3
          #2 0x7f0128c6449f  (<unknown module>)
          #3 0x7f0128c630d5  (<unknown module>)
          #4 0x7f012abcd018 in __wt_tiered_bucket_config /data/wiredtiger/build_posix/../src/tiered/tiered_config.c:120:5
          #5 0x7f012abce949 in __wt_tiered_conn_config /data/wiredtiger/build_posix/../src/tiered/tiered_config.c:157:9
          #6 0x7f012a638cdd in wiredtiger_open /data/wiredtiger/build_posix/../src/conn/conn_api.c:2823:5
          #7 0x7f012b0351a0 in _wrap_wiredtiger_open /data/wiredtiger/lang/python/wiredtiger_wrap.c:8864:16
      

            Assignee:
            sue.loverso@mongodb.com Susan LoVerso
            Reporter:
            keith.smith@mongodb.com Keith Smith
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: