-
Notifications
You must be signed in to change notification settings - Fork 81
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: failure to commit leads to inconsistencies between workflow and database #302
base: master
Are you sure you want to change the base?
Conversation
…database When a µTask worker fails to commit its current state to the database, it was sometimes not stopping the execution of its resolution. This leads to inconsistencies, as the step was currently RUNNING, but database state indicates TODO. In that way, if the worker crashes, then the new worker will restart with wrong information, inducing workflow issues. Signed-off-by: Romain Beuque <[email protected]>
CDS Report test#1183.0 ✘
|
@@ -699,7 +715,9 @@ func runAvailableSteps(dbp zesty.DBProvider, modifiedSteps map[string]bool, res | |||
if s.State != step.StateAfterrunError { | |||
res.SetStepState(s.Name, step.StateRunning) | |||
step.PreRun(s, res.Values, resolutionStateSetter(res, preRunModifiedSteps), executedSteps) | |||
commit(dbp, res, nil) | |||
if err := commit(dbp, res, nil); err != nil { | |||
return 0, err |
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.
Problem in my current implementation is that exiting the runAvailableSteps
here, will close the main loop, while some step might still be running.
Not sure how we should handle this.
Signed-off-by: Romain Beuque <[email protected]>
CDS Report package#1184.0 ✘
|
if async { | ||
go resolve(dbp, res, t, sm, e.wg, debugLogger) | ||
} else { | ||
resolve(dbp, res, t, sm, e.wg, debugLogger) | ||
err = resolve(dbp, res, t, sm, e.wg, debugLogger) |
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.
Might be replaced with return resolve(...), nil
, since there is nothing to do after the if
statement, which spares the declaration of err
above.
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Bug Fix
What is the current behavior? (You can also link to an open issue here)
When a µTask worker fails to commit its current state to the database,
it was sometimes not stopping the execution of its resolution. This
leads to inconsistencies, as the step was currently RUNNING, but
database state indicates TODO. In that way, if the worker crashes, then
the new worker will restart with wrong information, inducing workflow
issues.
Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
No
Other information: