Skip to content

bug: durable: a failed checkpoint after a landed Append leaves the Handle stuck on ErrStepConflict #241

Open

Description

@joshua-temple

Module

durable

What happened

Expected behavior

  • A step whose Append landed advances nextStep, even if the checkpoint after it fails.
  • The checkpoint failure is returned, and the next step still succeeds.

Reproduction

On main @ 494c78a, in package durable_test (uses the existing chainedTimerMachine, timerCtx, epoch helpers):

type failOnceCheckpoint struct {
	durable.Store
	failed bool
}

func (s *failOnceCheckpoint) Checkpoint(ctx context.Context, id durable.InstanceID, snap []byte, through int, opts ...durable.CheckpointOption) error {
	if through >= 0 && !s.failed {
		s.failed = true
		return errors.New("transient checkpoint I/O")
	}
	return s.Store.Checkpoint(ctx, id, snap, through, opts...)
}

func TestTickCheckpointFailure_DoesNotWedgeHandle(t *testing.T) {
	ctx := context.Background()
	st := &failOnceCheckpoint{Store: durable.NewMemStore()}
	clk := state.NewFakeClock(epoch)
	r := durable.NewRunner(chainedTimerMachine(), st,
		durable.WithRunnerClock[string, string, *timerCtx](clk),
		durable.WithCheckpointEvery[string, string, *timerCtx](2))
	h, _ := r.Start(ctx, "wedge", &timerCtx{}, state.WithInitialState("idle"))
	if _, err := h.Fire(ctx, "arm"); err != nil { // step 0
		t.Fatal(err)
	}
	clk.Advance(4 * time.Second)
	if _, err := h.Tick(ctx); err == nil { // step 1: Append lands, Checkpoint fails
		t.Fatal("expected injected checkpoint failure")
	}
	clk.Advance(8 * time.Second)
	if _, err := h.Tick(ctx); err != nil { // fails: ErrStepConflict on step 1
		t.Fatalf("Tick after a transient checkpoint failure: %v", err)
	}
}

Environment

  • Crucible module version: main @ 494c78a
  • Go version (go version): go1.27.3
  • OS / arch: darwin/arm64

Activity

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions