Fail actions which are interrupted due to an agent restart in the middle #16922
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If a unit agent is killed and restarted in the middle of running an action, the action stays forever in the running state. This is because the unit agent was not running the FailAction operation to mark the action as failed and hence terminate it. In addition, the commit operation at the end of the fail action was not wired up to correctly update local state to remove the action from the "todo" list.
QA steps
run an action like so
juju exec -u someunit/0 -- "echo hello; reboot"
After a few seconds for the machine to reboot, the CLI will exit back to a shell prompt (it blocks in the meantime).
The action is failed, and
juju show-task <n> --format yaml
shows the action was terminated and marked as failed.Previously the CLI would block forever and the action would stay in the running state.
Links
https://bugs.launchpad.net/juju/+bug/2012861
Jira card: JUJU-5438