Skip to content

Commit

Permalink
Retain task states for post stop tasks at the time of node GC (#18005)
Browse files Browse the repository at this point in the history
* Retain task states for post stop tasks at the time of node GC
  • Loading branch information
stswidwinski authored and jrasell committed Jul 26, 2023
1 parent 83f518e commit c1c04eb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
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

0 comments on commit c1c04eb

Please sign in to comment.