Skip to content
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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rbeuque74
Copy link
Member

  • 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:

…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 <556072+rbeuque74@users.noreply.github.com>
@ovh-cds
Copy link
Collaborator

ovh-cds commented Nov 30, 2021

CDS Report test#1183.0 ✘

  • tests and lint
    • golangci-lint ✘
    • unit-test and integration-tests ✔

@@ -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
Copy link
Member Author

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.

@rbeuque74 rbeuque74 changed the title fix: failure to commit leads to inconsistencies between workflow and … fix: failure to commit leads to inconsistencies between workflow and database Nov 30, 2021
Signed-off-by: Romain Beuque <556072+rbeuque74@users.noreply.github.com>
@ovh-cds
Copy link
Collaborator

ovh-cds commented Nov 30, 2021

CDS Report package#1184.0 ✘

  • Stage 1
    • Docker build ✘

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)
Copy link
Contributor

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.

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.

None yet

3 participants