Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the bug of SectorRetryFinalize dead loop after SubmitCommitAggregate while FinalizeEarly is true #6651

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion extern/storage-sealing/fsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ func (m *Sealing) plan(events []statemachine.Event, state *SectorInfo) (func(sta
case CommitWait:
return m.handleCommitWait, processed, nil
case CommitFinalize:
fallthrough
return m.handleCommitFinalizeSector, processed, nil
case FinalizeSector:
return m.handleFinalizeSector, processed, nil

Expand Down
12 changes: 12 additions & 0 deletions extern/storage-sealing/states_sealing.go
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,15 @@ func (m *Sealing) handleCommitWait(ctx statemachine.Context, sector SectorInfo)
return ctx.Send(SectorProving{})
}

func (m *Sealing) handleCommitFinalizeSector(ctx statemachine.Context, sector SectorInfo) error {
return m.doFinalizeSector(ctx, sector, true)
}

func (m *Sealing) handleFinalizeSector(ctx statemachine.Context, sector SectorInfo) error {
return m.doFinalizeSector(ctx, sector, false)
}

func (m *Sealing) doFinalizeSector(ctx statemachine.Context, sector SectorInfo, earlyFailedRetry bool) error {
// TODO: Maybe wait for some finality

cfg, err := m.getConfig()
Expand All @@ -695,6 +703,10 @@ func (m *Sealing) handleFinalizeSector(ctx statemachine.Context, sector SectorIn
}

if err := m.sealer.FinalizeSector(sector.sealingCtx(ctx.Context()), m.minerSector(sector.SectorType, sector.SectorNumber), sector.keepUnsealedRanges(false, cfg.AlwaysKeepUnsealedCopy)); err != nil {
if cfg.FinalizeEarly && earlyFailedRetry == false {
return ctx.Send(SectorFinalized{})
}

return ctx.Send(SectorFinalizeFailed{xerrors.Errorf("finalize sector: %w", err)})
}

Expand Down