Backup ID string memory leak during log recovery

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Backup
    • None
    • Environment:
      GCC 13, Ubuntu 24.04, Valgrind 3.22.0
    • Storage Engines - Transactions
    • 56.349
    • None
    • 1

      During connection startup recovery, replaying a force-stop incremental backup log record clears the WT_BLKINCR structure using WT_CLEAR in __txn_system_op_apply (src/txn/txn_recover.c line 190) without freeing the previously allocated backup ID string (id_str). This leaks the id_str memory allocated by a prior backup registration log record replayed in the same recovery pass via __wt_backup_set_blkincr (src/cursor/cur_backup.c line 75). To deterministically reproduce this leak in a test without spawning flaky external subprocesses or causing environment-specific file pollution on CI (Evergreen), the test reconfigures timing_stress_for_test=[checkpoint_slow] and executes the force-stop cursor close in a background thread. This allows to immediately copy the database home directory to simulate a crash before the slow checkpoint completes. Subsequent recovery is then executed on the copied directory in the main process to replay both backup ID records in a single recovery pass, exposing and validating the leak fix. I added before/after outputs on JIRA.

        1. after_fix_output.txt
          1 kB
        2. before_fix_output.txt
          2 kB

            Assignee:
            Unassigned
            Reporter:
            Tuna KARABACAK (EXT)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: