Skip to content

Log genuine block build failures instead of treating them as cancellations - #496

Open
samliok wants to merge 5 commits into
mainfrom
fix/block-build-failure-logged-as-cancel
Open

Log genuine block build failures instead of treating them as cancellations#496
samliok wants to merge 5 commits into
mainfrom
fix/block-build-failure-logged-as-cancel

Conversation

@samliok

@samliok samliok commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

In createBlockBuildingTask (simplex/epoch.go), the task called cancel() before the select that distinguishes a cancelled build from a failed one. cancel() closes the context's done channel synchronously, so the <-context.Done() case was always ready and the default branch logging "Failed building block" at Warn was unreachable.

Comment thread simplex/epoch_test.go Outdated
// TestEpochWarnsOnBlockBuildFailure asserts that a BuildBlock failure with no
// context cancellation is logged at Warn. createBlockBuildingTask used to call
// cancel() before checking context.Done(), so the warn was never emitted.
func TestEpochWarnsOnBlockBuildFailure(t *testing.T) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont think we need a test for this

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated 81820bb

Comment thread simplex/epoch.go Outdated
e.lock.Lock()
defer e.lock.Unlock()

// Record cancellation before cancel() closes the context,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need to write this comment.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated ee7ec04

Comment thread simplex/epoch_test.go Outdated
}
}

// failingBlockBuilder fails every BuildBlock call without the context being cancelled.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's a waste of test. Let's just remove this.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated 81820bb

Comment thread simplex/epoch.go
@samliok
samliok marked this pull request as ready for review August 6, 2026 20:52
Comment thread adapters.go
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.

2 participants