Don't hog task queue while waiting for exec process
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
parent
578bf0c70e
commit
920a9c21d7
1 changed files with 14 additions and 8 deletions
|
@ -73,6 +73,11 @@ func (s *Supervisor) execExit(t *ExecExitTask) error {
|
||||||
if err := container.RemoveProcess(t.PID); err != nil {
|
if err := container.RemoveProcess(t.PID); err != nil {
|
||||||
logrus.WithField("error", err).Error("containerd: find container for pid")
|
logrus.WithField("error", err).Error("containerd: find container for pid")
|
||||||
}
|
}
|
||||||
|
// If the exec spawned children which are still using its IO
|
||||||
|
// waiting here will block until they die or close their IO
|
||||||
|
// descriptors.
|
||||||
|
// Hence, we use a go routine to avoid block all other operations
|
||||||
|
go func() {
|
||||||
t.Process.Wait()
|
t.Process.Wait()
|
||||||
s.notifySubscribers(Event{
|
s.notifySubscribers(Event{
|
||||||
Timestamp: time.Now(),
|
Timestamp: time.Now(),
|
||||||
|
@ -81,5 +86,6 @@ func (s *Supervisor) execExit(t *ExecExitTask) error {
|
||||||
PID: t.PID,
|
PID: t.PID,
|
||||||
Status: t.Status,
|
Status: t.Status,
|
||||||
})
|
})
|
||||||
|
}()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue