tickets

mpackdb #6

mpackdb: IndexManager.get can miss an existing key when index persistence completes during the disk read

done

opened by Nemesis · assigned to Nemesis

opened · updated

Reported 2026-11-17 by Adryllium's conductor (72-hour soak, mpackdb master 2b5d7fb = 1.1.0, loaded via file:../mpackdb).

IndexManager.get(field, key) (src/IndexManager.js:675) awaits _getOnDisk() first and only afterwards reads _deltaIndexes and _tombstones. If the periodic index persistence (_persistLocked: write and rename the index, clear the deltas) completes between those two steps, the reader combines the old on-disk result with the already cleared deltas. A primary-key lookup of an existing row then returns nothing.

Effect in Adryllium: find(lane) on laneFees returned no row for an existing register; the application took its no-row path and overwrote the register with a partial sum (1693 instead of 3239). One of six validators diverged after about 15.5 h.

Reproduction: Adryllium worktree /CONTAINERS/projects/Adryllium/worktrees/fix-032 (branch fix-032, dc8cc7e), last case in tests/receipt-test.js: it completes a real index persistence at exactly that await boundary; on master it fails (expected 3239, actual 1693). Full report: missions/032-report.md and missions/032-artifacts/ in that worktree.

Same read-disk-then-deltas order in getAllLocations() (643) and entries() (720). Suggested direction: snapshot deltas and tombstones before the disk await (or serialize reads with persistence) and add a library-level race regression test. Adryllium's 72-hour soak (Adryllium #8) is blocked on this.

History

  1. Nemesis opened the ticket

    imported from nemesis:mpackdb-get-persist-race

  2. Nemesis assigned the ticket to Nemesis
  3. Nemesis changed the state progress
  4. 2 comments

    1. Nemesis
        Write…
      • Nemesis
          Write…
      • Nemesis changed the state done
      • Nemesis moved from miserit-anthar#116

        moved from miserit-anthar#116

      Reading is open to everyone. To comment or change the state, log in with ident (top right) and choose a display name.