This repository was archived by the owner on Dec 16, 2025. It is now read-only.
Fix contexts#1183
Closed
ceyonur wants to merge 8 commits into
Closed
Conversation
darioush
previously approved these changes
May 23, 2024
darioush
approved these changes
May 23, 2024
tsachiherman
left a comment
Contributor
There was a problem hiding this comment.
I have the same comment, which would apply at different locations - but with the same concern:
- terminating a method mid-flight might leave the database in a different state compared to it's existing behavior.
- I can't really tell if that would be an issue or not. Some code might need to be written differently to support that. ( i.e. perform a single commit instead of multiple commits ).
- If there is such a place where it would be hard to break a for-loop, I'd suggest placing the context checking both before and after the loop. That's not ideal, but it wouldn't cause any regression.
| // snapshots since the disk layer for snapshots will most likely be above the last committed | ||
| // state that reprocessing will start from. | ||
| func (bc *BlockChain) reprocessState(current *types.Block, reexec uint64) error { | ||
| func (bc *BlockChain) reprocessState(ctx context.Context, current *types.Block, reexec uint64) error { |
Contributor
There was a problem hiding this comment.
I really live the addition of an expiration context here. Two concerns:
- In the case of a context expiration, should we clear out the
currentblock so that this method would be atomic ? - Is there any state issue with partial execution of this method ? i.e. would terminating the execution in the middle would bring the node to some undesired state ?
Collaborator
Author
There was a problem hiding this comment.
I think contexts used to gracefully shutdown are safe to use, but we decided not to merge this PR as contexts from VM init can be closed from parent thread when SetState is called.
JonathanOppenheimer
added a commit
that referenced
this pull request
Oct 2, 2025
Signed-off-by: Stephen Buttolph <stephen@avalabs.org> Co-authored-by: Stephen Buttolph <stephen@avalabs.org>
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Oct 13, 2025
Signed-off-by: Stephen Buttolph <stephen@avalabs.org> Co-authored-by: Stephen Buttolph <stephen@avalabs.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why this should be merged
Replaced context.TODOs
Fixes: ava-labs/avalanchego#4730
How this was tested
Local UT/e2e tests
How is this documented
No need