-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Alloc restart does not restart one-shot lifecycle tasks #9464
Comments
I'm using Nomad 1.0.4 server and I got a similar issue. Nomad decided to restart the job on its own. The main task is fine, but the poststart task has not been run. |
If it helps, it seems that the main task has been restarted because of |
Hi all 👋 The work to enable this has been complete and release in Nomad v1.3.4. You can use the new |
I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues. |
Nomad version
Issue
The alloc restart command optimistically attempts to restart all tasks in the allocation; it collects any task-level errors and returns them:
https://github.com/hashicorp/nomad/blob/v1.0.0-beta3/client/allocrunner/alloc_runner.go#L1173-L1178
For an allocation with a dead
poststart
task, the main task will be restarted, but thepoststart
task will fail to restart withTask not running
(because it's dead).There are a few changes we could make here:
poststart
tasks should be re-run when the main tasks are restarted.RestartAll
should not return an error; for an alloc-level restart, we should not attempt to restart deadpoststart
taskspoststart
tasks, each will return an error on restart, resulting in the increasingly unhelpful error message:Reproduction steps
nomad alloc restart <alloc-id>
Job file (if appropriate)
Nomad Client logs (if appropriate)
If possible please post relevant logs in the issue.
Logs and other artifacts may also be sent to: nomad-oss-debug@hashicorp.com
Please link to your Github issue in the email and reference it in the subject
line:
Emails sent to that address are readable by all HashiCorp employees but are not publicly visible.
Nomad Server logs (if appropriate)
The text was updated successfully, but these errors were encountered: