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

Fix potential hot backup read lock never unlocked

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • WT10.0.1, 4.4.7, 5.0.0-rc0, 5.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • 3
    • Storage - Ra 2021-05-17, Storage - Ra 2021-05-31

      This code in conn_log.c appears to have an error:

              if (conn->hot_backup_start == 0 && conn->log_cursors == 0) {
                  WT_WITH_HOTBACKUP_READ_LOCK(session,
                    WT_ERR_ERROR_OK(
                      __wt_ftruncate(session, close_fh, close_end_lsn.l.offset), ENOTSUP, false),
                    NULL);
              }
       

      It's a problem to take an "early exit" (goto or return) out of a WT_WITH... macro, lest some resource be held.  In this case, the hotbackup read lock will be held if __wt_ftruncate fails.  We normally need to assign ret inside the WT_WITH... and check it outside the macro.

      See attached patch file - it contains a dist script to detect these sorts of errors.

            Assignee:
            jie.chen@mongodb.com Jie Chen
            Reporter:
            donald.anderson@mongodb.com Donald Anderson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: