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

Memory leak from split code

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • WT2.7.0
    • Affects Version/s: None
    • Component/s: None
    • None

      It is possible to generate a memory leak in WiredTiger with wtperf.

      The leaks are:

      ==9930==ERROR: LeakSanitizer: detected memory leaks
      
      Direct leak of 111024 byte(s) in 6939 object(s) allocated from:
          #0 0x4a5880 in calloc (/home/alexg/work/wiredtiger/build_posix/bench/wtperf/wtperf+0x4a5880)
          #1 0x707c0f in __wt_calloc /home/alexg/work/wiredtiger/build_posix/../src/os_posix/os_alloc.c:60:11
          #2 0xacfd7a in __wt_multi_to_ref /home/alexg/work/wiredtiger/build_posix/../src/btree/bt_split.c:1574:3
          #3 0xadef61 in __split_multi /home/alexg/work/wiredtiger/build_posix/../src/btree/bt_split.c:1929:3
          #4 0xadd7e4 in __wt_split_multi /home/alexg/work/wiredtiger/build_posix/../src/btree/bt_split.c:1980:13
          #5 0x64515a in __evict_page_dirty_update /home/alexg/work/wiredtiger/build_posix/../src/evict/evict_page.c:296:4
          #6 0x63ea9e in __wt_evict /home/alexg/work/wiredtiger/build_posix/../src/evict/evict_page.c:123:3
          #7 0x9eb58b in __wt_delete_page /home/alexg/work/wiredtiger/build_posix/../src/btree/bt_delete.c:80:9
          #8 0xb6a1ec in __wt_tree_walk /home/alexg/work/wiredtiger/build_posix/../src/btree/bt_walk.c:270:5
          #9 0xe71a87 in __wt_btcur_next /home/alexg/work/wiredtiger/build_posix/../src/btree/bt_curnext.c:530:3
          #10 0xee1f0f in __cursor_truncate /home/alexg/work/wiredtiger/build_posix/../src/btree/bt_cursor.c:1009:14
          #11 0xee00d9 in __wt_btcur_range_truncate /home/alexg/work/wiredtiger/build_posix/../src/btree/bt_cursor.c:1138:3
          #12 0xe01a93 in __wt_schema_range_truncate /home/alexg/work/wiredtiger/build_posix/../src/schema/schema_truncate.c:181:3
          #13 0x8a3394 in __session_truncate /home/alexg/work/wiredtiger/build_posix/../src/session/session_api.c:910:2
          #14 0x510d7d in run_truncate /home/alexg/work/wiredtiger/build_posix/bench/wtperf/../../../bench/wtperf/wtperf_truncate.c:187:13
          #15 0x4fd892 in worker /home/alexg/work/wiredtiger/build_posix/bench/wtperf/../../../bench/wtperf/wtperf.c:556:15
          #16 0x7fd6cffc1554 in start_thread (/lib64/libpthread.so.0+0x7554)
      
      Direct leak of 17712 byte(s) in 1107 object(s) allocated from:
          #0 0x4a5880 in calloc (/home/alexg/work/wiredtiger/build_posix/bench/wtperf/wtperf+0x4a5880)
          #1 0x707c0f in __wt_calloc /home/alexg/work/wiredtiger/build_posix/../src/os_posix/os_alloc.c:60:11
          #2 0xacfd7a in __wt_multi_to_ref /home/alexg/work/wiredtiger/build_posix/../src/btree/bt_split.c:1574:3
          #3 0xadef61 in __split_multi /home/alexg/work/wiredtiger/build_posix/../src/btree/bt_split.c:1929:3
          #4 0xadd7e4 in __wt_split_multi /home/alexg/work/wiredtiger/build_posix/../src/btree/bt_split.c:1980:13
          #5 0x64515a in __evict_page_dirty_update /home/alexg/work/wiredtiger/build_posix/../src/evict/evict_page.c:296:4
          #6 0x63ea9e in __wt_evict /home/alexg/work/wiredtiger/build_posix/../src/evict/evict_page.c:123:3
          #7 0xeeaa39 in __wt_page_release_evict /home/alexg/work/wiredtiger/build_posix/../src/include/btree.i:1141:13
          #8 0xee8843 in __wt_page_release /home/alexg/work/wiredtiger/build_posix/../src/include/btree.i:1203:2
          #9 0xed36bc in __curfile_leave /home/alexg/work/wiredtiger/build_posix/../src/include/cursor.i:133:8
          #10 0xecb736 in __cursor_func_init /home/alexg/work/wiredtiger/build_posix/../src/include/cursor.i:250:3
          #11 0xed64ed in __wt_btcur_remove /home/alexg/work/wiredtiger/build_posix/../src/btree/bt_cursor.c:657:8
          #12 0xee1c5f in __cursor_truncate /home/alexg/work/wiredtiger/build_posix/../src/btree/bt_cursor.c:1000:8
          #13 0xee00d9 in __wt_btcur_range_truncate /home/alexg/work/wiredtiger/build_posix/../src/btree/bt_cursor.c:1138:3
          #14 0xe01a93 in __wt_schema_range_truncate /home/alexg/work/wiredtiger/build_posix/../src/schema/schema_truncate.c:181:3
          #15 0x8a3394 in __session_truncate /home/alexg/work/wiredtiger/build_posix/../src/session/session_api.c:910:2
          #16 0x510d7d in run_truncate /home/alexg/work/wiredtiger/build_posix/bench/wtperf/../../../bench/wtperf/wtperf_truncate.c:187:13
          #17 0x4fd892 in worker /home/alexg/work/wiredtiger/build_posix/bench/wtperf/../../../bench/wtperf/wtperf.c:556:15
          #18 0x7fd6cffc1554 in start_thread (/lib64/libpthread.so.0+0x7554)
      
      Indirect leak of 69362 byte(s) in 6939 object(s) allocated from:
          #0 0x4a5880 in calloc (/home/alexg/work/wiredtiger/build_posix/bench/wtperf/wtperf+0x4a5880)
          #1 0x707c0f in __wt_calloc /home/alexg/work/wiredtiger/build_posix/../src/os_posix/os_alloc.c:60:11
          #2 0x70b32f in __wt_strndup /home/alexg/work/wiredtiger/build_posix/../src/os_posix/os_alloc.c:224:2
          #3 0xad0302 in __wt_multi_to_ref /home/alexg/work/wiredtiger/build_posix/../src/btree/bt_split.c:1578:3
          #4 0xadef61 in __split_multi /home/alexg/work/wiredtiger/build_posix/../src/btree/bt_split.c:1929:3
          #5 0xadd7e4 in __wt_split_multi /home/alexg/work/wiredtiger/build_posix/../src/btree/bt_split.c:1980:13
          #6 0x64515a in __evict_page_dirty_update /home/alexg/work/wiredtiger/build_posix/../src/evict/evict_page.c:296:4
          #7 0x63ea9e in __wt_evict /home/alexg/work/wiredtiger/build_posix/../src/evict/evict_page.c:123:3
          #8 0x9eb58b in __wt_delete_page /home/alexg/work/wiredtiger/build_posix/../src/btree/bt_delete.c:80:9
          #9 0xb6a1ec in __wt_tree_walk /home/alexg/work/wiredtiger/build_posix/../src/btree/bt_walk.c:270:5
          #10 0xe71a87 in __wt_btcur_next /home/alexg/work/wiredtiger/build_posix/../src/btree/bt_curnext.c:530:3
          #11 0xee1f0f in __cursor_truncate /home/alexg/work/wiredtiger/build_posix/../src/btree/bt_cursor.c:1009:14
          #12 0xee00d9 in __wt_btcur_range_truncate /home/alexg/work/wiredtiger/build_posix/../src/btree/bt_cursor.c:1138:3
          #13 0xe01a93 in __wt_schema_range_truncate /home/alexg/work/wiredtiger/build_posix/../src/schema/schema_truncate.c:181:3
          #14 0x8a3394 in __session_truncate /home/alexg/work/wiredtiger/build_posix/../src/session/session_api.c:910:2
          #15 0x510d7d in run_truncate /home/alexg/work/wiredtiger/build_posix/bench/wtperf/../../../bench/wtperf/wtperf_truncate.c:187:13
          #16 0x4fd892 in worker /home/alexg/work/wiredtiger/build_posix/bench/wtperf/../../../bench/wtperf/wtperf.c:556:15
          #17 0x7fd6cffc1554 in start_thread (/lib64/libpthread.so.0+0x7554)
      
      Indirect leak of 10524 byte(s) in 1107 object(s) allocated from:
          #0 0x4a5880 in calloc (/home/alexg/work/wiredtiger/build_posix/bench/wtperf/wtperf+0x4a5880)
          #1 0x707c0f in __wt_calloc /home/alexg/work/wiredtiger/build_posix/../src/os_posix/os_alloc.c:60:11
          #2 0x70b32f in __wt_strndup /home/alexg/work/wiredtiger/build_posix/../src/os_posix/os_alloc.c:224:2
          #3 0xad0302 in __wt_multi_to_ref /home/alexg/work/wiredtiger/build_posix/../src/btree/bt_split.c:1578:3
          #4 0xadef61 in __split_multi /home/alexg/work/wiredtiger/build_posix/../src/btree/bt_split.c:1929:3
          #5 0xadd7e4 in __wt_split_multi /home/alexg/work/wiredtiger/build_posix/../src/btree/bt_split.c:1980:13
          #6 0x64515a in __evict_page_dirty_update /home/alexg/work/wiredtiger/build_posix/../src/evict/evict_page.c:296:4
          #7 0x63ea9e in __wt_evict /home/alexg/work/wiredtiger/build_posix/../src/evict/evict_page.c:123:3
          #8 0xeeaa39 in __wt_page_release_evict /home/alexg/work/wiredtiger/build_posix/../src/include/btree.i:1141:13
          #9 0xee8843 in __wt_page_release /home/alexg/work/wiredtiger/build_posix/../src/include/btree.i:1203:2
          #10 0xed36bc in __curfile_leave /home/alexg/work/wiredtiger/build_posix/../src/include/cursor.i:133:8
          #11 0xecb736 in __cursor_func_init /home/alexg/work/wiredtiger/build_posix/../src/include/cursor.i:250:3
          #12 0xed64ed in __wt_btcur_remove /home/alexg/work/wiredtiger/build_posix/../src/btree/bt_cursor.c:657:8
          #13 0xee1c5f in __cursor_truncate /home/alexg/work/wiredtiger/build_posix/../src/btree/bt_cursor.c:1000:8
          #14 0xee00d9 in __wt_btcur_range_truncate /home/alexg/work/wiredtiger/build_posix/../src/btree/bt_cursor.c:1138:3
          #15 0xe01a93 in __wt_schema_range_truncate /home/alexg/work/wiredtiger/build_posix/../src/schema/schema_truncate.c:181:3
          #16 0x8a3394 in __session_truncate /home/alexg/work/wiredtiger/build_posix/../src/session/session_api.c:910:2
          #17 0x510d7d in run_truncate /home/alexg/work/wiredtiger/build_posix/bench/wtperf/../../../bench/wtperf/wtperf_truncate.c:187:13
          #18 0x4fd892 in worker /home/alexg/work/wiredtiger/build_posix/bench/wtperf/../../../bench/wtperf/wtperf.c:556:15
          #19 0x7fd6cffc1554 in start_thread (/lib64/libpthread.so.0+0x7554)
      
      SUMMARY: AddressSanitizer: 208622 byte(s) leaked in 16092 allocation(s).
      

      The workload I'm using to reliably generate the memory leak is:

      conn_config="cache_size=1GB,checkpoint=(wait=5)"
      table_config="type=file"
      icount=500000
      report_interval=5
      run_time=20
      populate_threads=1
      # A high insert throughput, but not maxed out. So truncate can keep up.
      threads=((count=2,reads=1,ops_per_txn=100),(count=3,inserts=1,throttle=80000),(count=1,truncate=1,truncate_pct=10,truncate_count=1000000))
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            alexander.gorrod@mongodb.com Alexander Gorrod
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: