mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 10:25:42 +03:00
Retain task states for post stop tasks at the time of node GC (#18005)
* Retain task states for post stop tasks at the time of node GC
This commit is contained in:
3
.changelog/17971.txt
Normal file
3
.changelog/17971.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
```release-note:bug
|
||||
client: Fixed a bug where the state of poststop tasks could be corrupted by client gc
|
||||
```
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user