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

Backport of Retain task states for post stop tasks at the time of node GC into release/1.6.x #18033

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/17971.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
client: Fixed a bug where the state of poststop tasks could be corrupted by client gc
```
13 changes: 13 additions & 0 deletions client/allocrunner/alloc_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,19 @@ func (ar *allocRunner) killTasks() map[string]*structs.TaskState {
}
wg.Wait()

// Perform no action on post stop tasks, but retain their states if they exist. This
// commonly happens at the time of alloc GC from the client node.
for name, tr := range ar.tasks {
if !tr.IsPoststopTask() {
continue
}

state := tr.TaskState()
if state != nil {
states[name] = state
}
}

return states
}

Expand Down