Skip to content

fix: failure to commit leads to inconsistencies between workflow and database#302

Draft
rbeuque74 wants to merge 2 commits intomasterfrom
dev/rbeuque/fix-fail-to-commit
Draft

fix: failure to commit leads to inconsistencies between workflow and database#302
rbeuque74 wants to merge 2 commits intomasterfrom
dev/rbeuque/fix-fail-to-commit

Conversation

@rbeuque74
Copy link
Copy Markdown
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>
@rbeuque74 rbeuque74 requested review from loopfz and wI2L November 30, 2021 11:59
@ovh-cds
Copy link
Copy Markdown
Collaborator

ovh-cds commented Nov 30, 2021

CDS Report test#1183.0 ✘

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

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
Copy Markdown
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
Copy Markdown
Collaborator

ovh-cds commented Nov 30, 2021

CDS Report package#1184.0 ✘

  • Stage 1
    • Docker build ✘

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
Copy Markdown
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.

3 participants