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

Segmentation fault when dumping the cache

    • 5
    • 2023-05-02 StorEng Bug Bash

      While trying to reproduce WT-10802, I added the following code:

      diff --git a/src/txn/txn_ckpt.c b/src/txn/txn_ckpt.c
      index 2a3935e7c..bddd02c25 100644
      --- a/src/txn/txn_ckpt.c
      +++ b/src/txn/txn_ckpt.c
      @@ -1732,6 +1732,8 @@ __checkpoint_lock_dirty_tree_int(WT_SESSION_IMPL *session, bool is_checkpoint, b
                       F_CLR(ckpt, WT_CKPT_DELETE);
                       continue;
                   }
      +            WT_IGNORE_RET(__wt_verbose_dump_txn(session));
      +            WT_IGNORE_RET(__wt_verbose_dump_cache(session));
                   WT_RET_MSG(session, ret, "checkpoint %s cannot be dropped when in-use", ckpt->name);
               }
           /*
      

      This resulted in a segfault:

      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  __wt_page_in_func (session=session@entry=0x22688c0, ref=ref@entry=0x7f67cf09da80, flags=flags@entry=2487, func=func@entry=0x7f684d3193e0 <__PRETTY_FUNCTION__.7> "__tree_walk_internal", line=line@entry=460) at ../src/btree/bt_read.c:427
      427                 if (page->read_gen == WT_READGEN_NOTSET) {
      [Current thread is 1 (Thread 0x7f68237fe700 (LWP 1748))]
      (gdb) where
      #0  __wt_page_in_func (session=session@entry=0x22688c0, ref=ref@entry=0x7f67cf09da80, flags=flags@entry=2487, func=func@entry=0x7f684d3193e0 <__PRETTY_FUNCTION__.7> "__tree_walk_internal", line=line@entry=460) at ../src/btree/bt_read.c:427
      #1  0x00007f684d146595 in __wt_page_swap_func (session=session@entry=0x22688c0, held=held@entry=0x7f67cf09b720, want=want@entry=0x7f67cf09da80, flags=2487, func=func@entry=0x7f684d3193e0 <__PRETTY_FUNCTION__.7> "__tree_walk_internal", line=line@entry=460) at ../src/include/btree_inline.h:2193
      #2  0x00007f684d146ff8 in __tree_walk_internal (session=session@entry=0x22688c0, refp=refp@entry=0x7f68237fb708, walkcntp=walkcntp@entry=0x0, skip_func=skip_func@entry=0x0, func_cookie=func_cookie@entry=0x0, flags=2355, flags@entry=2099) at ../src/btree/bt_walk.c:460
      #3  0x00007f684d14738a in __wt_tree_walk (session=session@entry=0x22688c0, refp=refp@entry=0x7f68237fb708, flags=flags@entry=2099) at ../src/btree/bt_walk.c:530
      #4  0x00007f684d1f705a in __verbose_dump_cache_single (session=session@entry=0x22688c0, total_bytesp=total_bytesp@entry=0x7f68237fbbc0, total_dirty_bytesp=total_dirty_bytesp@entry=0x7f68237fbbb8, total_updates_bytesp=total_updates_bytesp@entry=0x7f68237fbbb0) at ../src/evict/evict_lru.c:2640
      #5  0x00007f684d1f7561 in __verbose_dump_cache_apply (session=session@entry=0x22688c0, total_bytesp=total_bytesp@entry=0x7f68237fbbc0, total_dirty_bytesp=total_dirty_bytesp@entry=0x7f68237fbbb8, total_updates_bytesp=total_updates_bytesp@entry=0x7f68237fbbb0) at ../src/evict/evict_lru.c:2729
      #6  0x00007f684d1ffb25 in __wt_verbose_dump_cache (session=session@entry=0x22688c0) at ../src/evict/evict_lru.c:2768
      #7  0x00007f684d2ff5aa in __checkpoint_lock_dirty_tree_int (session=session@entry=0x22688c0, is_checkpoint=is_checkpoint@entry=true, force=force@entry=true, btree=btree@entry=0x34f73d0, ckpt=0x7f67f943c778, ckpt@entry=0x7f67f943ca68, ckptbase=<optimized out>) at ../src/txn/txn_ckpt.c:1736
      #8  0x00007f684d300f66 in __checkpoint_lock_dirty_tree (session=session@entry=0x22688c0, is_checkpoint=is_checkpoint@entry=true, force=force@entry=true, need_tracking=need_tracking@entry=true, cfg=cfg@entry=0x7f68237fda10) at ../src/txn/txn_ckpt.c:1911
      #9  0x00007f684d3013ae in __wt_checkpoint_get_handles (session=session@entry=0x22688c0, cfg=cfg@entry=0x7f68237fda10) at ../src/txn/txn_ckpt.c:438
      #10 0x00007f684d2391d9 in __meta_btree_apply (session=session@entry=0x22688c0, cursor=0x7f67f8d859b0, file_func=file_func@entry=0x7f684d301078 <__wt_checkpoint_get_handles>, name_func=name_func@entry=0x0, cfg=cfg@entry=0x7f68237fda10) at ../src/meta/meta_apply.c:57
      #11 0x00007f684d239471 in __wt_meta_apply_all (session=session@entry=0x22688c0, file_func=file_func@entry=0x7f684d301078 <__wt_checkpoint_get_handles>, name_func=name_func@entry=0x0, cfg=cfg@entry=0x7f68237fda10) at ../src/meta/meta_apply.c:78
      #12 0x00007f684d30009a in __checkpoint_apply_operation (session=session@entry=0x22688c0, cfg=cfg@entry=0x7f68237fda10, op=op@entry=0x7f684d301078 <__wt_checkpoint_get_handles>) at ../src/txn/txn_ckpt.c:309
      #13 0x00007f684d3021de in __checkpoint_prepare (session=session@entry=0x22688c0, trackingp=trackingp@entry=0x7f68237fd8ed, cfg=cfg@entry=0x7f68237fda10) at ../src/txn/txn_ckpt.c:801
      #14 0x00007f684d30339e in __txn_checkpoint (session=session@entry=0x22688c0, cfg=0x7f68237fda10) at ../src/txn/txn_ckpt.c:1099
      #15 0x00007f684d30427b in __txn_checkpoint_wrapper (session=session@entry=0x22688c0, cfg=cfg@entry=0x7f68237fda10) at ../src/txn/txn_ckpt.c:1397
      #16 0x00007f684d30443e in __wt_txn_checkpoint (session=session@entry=0x22688c0, cfg=cfg@entry=0x7f68237fda10, waiting=waiting@entry=true) at ../src/txn/txn_ckpt.c:1474
      #17 0x00007f684d2b728b in __session_checkpoint (wt_session=0x22688c0, config=0x7f68237fde60 "name=mine.1") at ../src/session/session_api.c:2303
      #18 0x0000000000405627 in checkpoint (arg=<optimized out>) at ../test/format/checkpoint.c:149
      #19 0x00007f684ce5b6db in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
      #20 0x00007f684c77861f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      The page is NULL:

      (gdb) f 0
      #0  __wt_page_in_func (session=session@entry=0x22688c0, ref=ref@entry=0x7f67cf09da80, flags=flags@entry=2487, func=func@entry=0x7f684d3193e0 <__PRETTY_FUNCTION__.7> "__tree_walk_internal", line=line@entry=460) at ../src/btree/bt_read.c:427
      427                 if (page->read_gen == WT_READGEN_NOTSET) {
      (gdb) p page
      $1 = (WT_PAGE *) 0x0
      

        1. full stacktrace.txt
          45 kB
          Etienne Petrel

            Assignee:
            etienne.petrel@mongodb.com Etienne Petrel
            Reporter:
            etienne.petrel@mongodb.com Etienne Petrel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: