-
Notifications
You must be signed in to change notification settings - Fork 180
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
[Execution] Fix stop control #5327
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -205,7 +205,8 @@ func (e *Engine) BlockProcessable(b *flow.Header, _ *flow.QuorumCertificate) { | |
|
||
// TODO: this should not be blocking: https://github.com/onflow/flow-go/issues/4400 | ||
|
||
// skip if stopControl tells to skip | ||
// skip if stopControl tells to skip, so that we can avoid fetching collections | ||
// for this block | ||
if !e.stopControl.ShouldExecuteBlock(b) { | ||
return | ||
} | ||
|
@@ -363,6 +364,12 @@ func (e *Engine) executeBlock( | |
ctx context.Context, | ||
executableBlock *entity.ExecutableBlock, | ||
) { | ||
|
||
// don't execute the block if the stop control says no | ||
if !e.stopControl.ShouldExecuteBlock(executableBlock.Block.Header) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Stop control should check again here, because otherwise there is an edge case that might execute blocks above the stop height. See the comment on L457 The edge case is that, when a block becomes processable, the stop height might not be set, so it's added to the queue, however, when it becomes executable and is able to execute, the stop height is set, and should not be executed. Without this check, it will be executed, but should not. |
||
return | ||
} | ||
|
||
lg := e.log.With(). | ||
Hex("block_id", logging.Entity(executableBlock)). | ||
Uint64("height", executableBlock.Block.Header.Height). | ||
|
@@ -445,6 +452,8 @@ func (e *Engine) executeBlock( | |
Int64("timeSpentInMS", time.Since(startedAt).Milliseconds()). | ||
Msg("block executed") | ||
|
||
e.stopControl.OnBlockExecuted(executableBlock.Block.Header) | ||
|
||
err = e.onBlockExecuted(executableBlock, finalEndState) | ||
if err != nil { | ||
lg.Err(err).Msg("failed in process block's children") | ||
|
@@ -454,8 +463,6 @@ func (e *Engine) executeBlock( | |
e.executionDataPruner.NotifyFulfilledHeight(executableBlock.Height()) | ||
} | ||
|
||
e.stopControl.OnBlockExecuted(executableBlock.Block.Header) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. stopControl.OnBlockExecuted is to report a block has been executed and triggers stop control to check whether it should stop/crash or not. However, this is currently called after Given two blocks: A <- B and we set stop height as B, meaning stop as soon as A is executed, and don't execute B. OK, now both block A and B's collections have been received, after A is executed, B becomes ready to be executed, if So my solution here is to 1) move this line up before the |
||
|
||
e.unit.Ctx() | ||
|
||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now, this is the only place we check.