ExportXMLWordPrintableJSON

    • Storage Engines, Storage Engines - Persistence
    • 0.003
    • StorEng - Defined Pipeline
    • None

      Problem
      __block_disagg_destroy() locates the block-list bucket from block_disagg->name:

      hash = __wt_hash_city64(block_disagg->name, strlen(block_disagg->name));
      

      If __wti_block_disagg_open() fails between WT_CONN_BLOCK_INSERT and a successful __wt_strdup(), name is still NULL: the handle is zeroed by __wt_calloc_one, and __wt_strndup leaves the destination untouched when __wt_malloc fails. The error path then calls __block_disagg_destroy() and segfaults in strlen(NULL), with conn->block_lock held and a half-initialized handle left in conn->blockhash.

      In practice this is ENOMEM during a disaggregated block open: the open should return ENOMEM but crashes instead.

      Repro
      Catch2 test in test_block_handle_type.cpp with an injected ENOMEM before the __wt_strdup():

      strlen
      __block_disagg_destroy         block_disagg_open.c:45
      __wti_block_disagg_open        block_disagg_open.c:138
      __wt_block_disagg_manager_open block_disagg_mgr.c:278
      

      Fix
      Copy the name before WT_CONN_BLOCK_INSERT, and have __block_disagg_destroy remove the handle from the lists only when name != NULL. A guard in destroy alone is not enough: without the reorder a NULL-named handle stays in conn->blockhash.

            Assignee:
            Etienne Petrel
            Reporter:
            Etienne Petrel
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: