Skip to content

fix(factory): evict sender when an action panics during minting#4921

Open
envestcc wants to merge 1 commit into
masterfrom
fix/mint-evict-panicking-action
Open

fix(factory): evict sender when an action panics during minting#4921
envestcc wants to merge 1 commit into
masterfrom
fix/mint-evict-panicking-action

Conversation

@envestcc

Copy link
Copy Markdown
Member

#4840 recovers panics on the mint path so a doomed draft cannot crash the process, and #4920 extends the same recover to ValidateBlock. Neither removes the offending action from the pool, though: today a panic while runAction executes a single pending action unwinds past the sender-eviction logic in validateAndRun and is only caught by the mint goroutine's top-level recover, discarding the whole draft. The same action is then picked up again on the next mint attempt.

This adds a recover scoped to the single-action runAction call during minting, converting the panic into an ordinary error so it flows through the existing default-error handling in validateAndRun — which already evicts the sender from the pool before the draft is abandoned for any other unexpected error.

  • Still discards this draft (unchanged behavior), but the sender no longer stays in the pool to be retried on the next mint attempt — a repeated failure loop becomes a one-time lost draft.
  • No apply-semantics change, so this needs no fork gate.
  • Adds a iotex_mint_action_panics_total metric and a regression test.

If a single pending action panics while runAction executes it during
minting, the panic previously unwound past the sender-eviction logic in
validateAndRun and was only caught by the mint goroutine's top-level
recover, discarding the whole draft without removing the action from
the pool. The same action would then be retried on every subsequent
mint attempt.

Recover the panic right around the single-action runAction call so it
is converted into an ordinary error and routed through the existing
default-error handling, which evicts the sender from the pool before
this draft is abandoned. This turns a potential run of repeated draft
failures into a one-time lost draft.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@envestcc envestcc requested a review from a team as a code owner July 13, 2026 02:25
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
21.8% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

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.

1 participant