mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 10:25:42 +03:00
Merge pull request #5429 from hashicorp/b-blocking-executor-shutdown
executor: block shutdown on process exiting
This commit is contained in:
@@ -349,10 +349,21 @@ func (l *LibcontainerExecutor) Shutdown(signal string, grace time.Duration) erro
|
||||
case <-time.After(grace):
|
||||
// Force kill all container processes after grace period,
|
||||
// hence `true` argument.
|
||||
return l.container.Signal(os.Kill, true)
|
||||
if err := l.container.Signal(os.Kill, true); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return l.container.Signal(os.Kill, true)
|
||||
if err := l.container.Signal(os.Kill, true); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
select {
|
||||
case <-l.userProcExited:
|
||||
return nil
|
||||
case <-time.After(time.Second * 15):
|
||||
return fmt.Errorf("process failed to exit after 15 seconds")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user