Skip to content

Avoid calling OnBlockEnd on panic #31828

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

maoueh
Copy link
Contributor

@maoueh maoueh commented May 14, 2025

This avoid problem where the tracer receives OnBlockEnd(nil) and thus cannot know that an error happen, in which case it could flush data out.

Technically, shouldn't be a big problem as since there is a panic, the block will not be committed to geth storage and will be replayed correctly.

The other possibility would be to still call the tracer but passing the recovered error to OnBlockEnd, but this would require transforming the recovered any type into an error.

Relates to #31226, unsure if it would handle the case here.

This avoid problem where the tracer receives `OnBlockEnd(nil)` and thus cannot know that an error happen, in which case it could flush data out.

Technically, shouldn't be a big problem as since there is a panic, the block will not be committed to geth storage and will be replayed correctly.

The other possibility would be to still call the tracer but passing the recovered error to `OnBlockEnd`, but this would require transforming the recovered `any` type into an `error`.
@s1na
Copy link
Contributor

s1na commented May 16, 2025

Right I see it. This is true for all of the other deferred hooks, e.g. OnTxEnd. If any of their lower level hooks panics they will still be called.

#31226 will fix this but I am unsure of that PR because of the performance penalty.

On the other hand, this PR will catch any panic not only the ones arising from the tracer. One could make the case that if anything panics in the blockchain we should probably stop reporting to the tracer altogether but even then I would like to make a more comprehensive fix than just for one of the hooks.

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