Skip to content

Debug engine exits ~5 min after restart: forget-window break 'keys in unload::drive fails the incremental-drive check (debug builds only) #6038

Backlog

Description

@cleaton

A debug engine started on existing storage exits (code 70) about 5 minutes after startup:

level=error message="invalid state machine state" machine=tablet_maintainer_machine
error="incremental maintainer drives emitted 7 effects where a full pass emits more or others;
full pass only: [Execute(ReadRowRequest { ..., read: Incarnation(..) })] after Input(ReadRowResponse { .. })"

It reproduces every time (3/3, rc.5 and rc.9) with an idle engine on a saved local storage snapshot. The engine exits at 345 s. At about 330 s, holder_check_after_ms (300 s) starts a burst of HolderGone unloads (about 185 in progress, 217 completed in release) for volumes left by earlier engine processes. I don't have a minimal repro yet.

Cause

In state/unload.rs drive(), when the forget window is full (max_forgets_in_flight, 32/32 at failure), the loop does break 'keys and moves every volume it hasn't reached into window_waiting. So the outcome for a volume depends on which other volumes happen to be marked:

  • Incremental pass: only the volume whose row read just returned is marked. It's visited and starts a RecoverVolumeRequest. Repair slots were free: 1/4 in use.
  • Full pass (unload::mark_all): earlier volumes waiting to forget hit the full window first and break the loop. That volume is never reached, and no recovery starts.

A diagnostic build confirmed that unload::mark_all alone produces the mismatch, and the deletion, filesystem and store steps don't. The reported ReadRowRequest is only an op-id shift caused by the missing recovery.

Possible fix: on a full window, skip only the forget step instead of breaking, so other steps (recovery, row checks) still run for the remaining volumes.

Only debug builds crash

  • The check (check_incremental_drives, mod.rs) and the exit (debug_validate → env.exit(70), state-machine-durable/src/runner.rs) are both #[cfg(debug_assertions)]. Release builds run only the incremental pass. No Cargo profile overrides debug-assertions, so dev/quick exit and release/self-host-release/profiling don't.
  • Verified: a release build (3.1.2-rc.9) on the same snapshot ran 15 min with no errors. At the holder check (330–360 s) it unloaded 217 holder-gone volumes (loaded 505 → 302), then kept unloading slowly (231 total).
  • Release builds still have the break 'keys ordering, just unchecked. Expected impact is a delayed unload recovery, not a stall. The release metrics (30 s samples) fit that but can't show the delay itself.
  • Locally, engine-process picks target/debug/rivet-engine, so local development and benchmarks hit the crash.

Activity

  1. linear-code commented on Nov 27, 2026

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions