Skip to content

[storage/ordinal] fix panic in get after prune fails mid-removal#3530

Open
0xAysh wants to merge 1 commit intocommonwarexyz:mainfrom
0xAysh:fix/ordinal-prune-interval-panic
Open

[storage/ordinal] fix panic in get after prune fails mid-removal#3530
0xAysh wants to merge 1 commit intocommonwarexyz:mainfrom
0xAysh:fix/ordinal-prune-interval-panic

Conversation

@0xAysh
Copy link
Copy Markdown

@0xAysh 0xAysh commented Apr 3, 2026

Fixes #2069

Problem

Ordinal::get assumes that if self.intervals contains an index, self.blobs must have the corresponding section:

  let blob = self.blobs.get(&section).unwrap();

prune removes a section in three steps:

  1. self.blobs.remove(&section)    -- remove from in-memory map
  2. context.remove(...).await?     -- delete from disk
  3. self.intervals.remove(...)     -- remove from intervals

If step 2 fails, ? returns early and step 3 never runs. Now blobs is missing the section but intervals still has its indices. The next call to get for one of those indices passes the intervals check and panics on the unwrap.

Fix

Move self.intervals.remove to before context.remove. If the disk deletion fails, both maps are already consistent, and get returns Ok(None) instead of panicking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

panicking at storage/src/ordinal/storage.rs:281

1 participant