-
Notifications
You must be signed in to change notification settings - Fork 476
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
Fix/initsteps race condition #8145
base: master
Are you sure you want to change the base?
Conversation
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.
I like going to task, I think we can avoid changing IStep
interface and make InitStep
wrapper (can be private class of StepManager) rather than base class.
} | ||
catch | ||
{ | ||
_taskCompletedSource.SetCanceled(); |
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.
I think this should be set exception?
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.
It would create a cascade effect where all depending steps would write an error to the log.
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.
Can you add comment about why it is that way then?
_allPending.Enqueue(task); | ||
} | ||
else | ||
createdSteps.Add(step.GetType(), new StepWrapper(step)); |
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.
The dependency is mapped by StepBaseType
@@ -153,7 +153,7 @@ public StepA(NethermindApi runnerContext) | |||
} | |||
} | |||
|
|||
[RunnerStepDependencies(typeof(StepC))] | |||
[RunnerStepDependencies(typeof(StepCStandard))] |
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.
I think the previous test case is correct, the dependency is declared by base type not the subtype. Its a subtle thing that plugins rely on.
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.
Ok I see. If that is the intended behavior there can be an issue if steps are inhering from another step like InitDatabaseSnapshot
and something then uses that as a dependency.
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.
Many scary issue that I don't want to bring in my sleep.
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.
In my original implementation, that wasn't an issue, steps were grouped by base step for dependency resolution
that is why _allStepsByBaseType existed
Fixes #8122
Changes
When a
IStep
fails it can cause the main process to hang in an Autoreset Event.I have refactored the flow in
EthereumStepsManager
to be based on awaitable tasks instead, avoiding any race conditions and greatly simplyfying it.Task
instead of reset event.Types of changes
What types of changes does your code introduce?
Testing
Requires testing
If yes, did you write tests?
Notes on testing
Optional. Remove if not applicable.
Documentation
Requires documentation update
If yes, link the PR to the docs update or the issue with the details labeled
docs
. Remove if not applicable.Requires explanation in Release Notes
If yes, fill in the details here. Remove if not applicable.
Remarks
Optional. Remove if not applicable.