|
@@ -544,6 +544,8 @@ func (clnt *client) Restore(containerID string, options ...CreateOption) error {
|
|
if err := clnt.Signal(containerID, int(syscall.SIGTERM)); err != nil {
|
|
if err := clnt.Signal(containerID, int(syscall.SIGTERM)); err != nil {
|
|
logrus.Errorf("libcontainerd: error sending sigterm to %v: %v", containerID, err)
|
|
logrus.Errorf("libcontainerd: error sending sigterm to %v: %v", containerID, err)
|
|
}
|
|
}
|
|
|
|
+ // Let the main loop handle the exit event
|
|
|
|
+ clnt.remote.Unlock()
|
|
select {
|
|
select {
|
|
case <-time.After(10 * time.Second):
|
|
case <-time.After(10 * time.Second):
|
|
if err := clnt.Signal(containerID, int(syscall.SIGKILL)); err != nil {
|
|
if err := clnt.Signal(containerID, int(syscall.SIGKILL)); err != nil {
|
|
@@ -552,9 +554,13 @@ func (clnt *client) Restore(containerID string, options ...CreateOption) error {
|
|
select {
|
|
select {
|
|
case <-time.After(2 * time.Second):
|
|
case <-time.After(2 * time.Second):
|
|
case <-w.wait():
|
|
case <-w.wait():
|
|
|
|
+ // relock because of the defer
|
|
|
|
+ clnt.remote.Lock()
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
case <-w.wait():
|
|
case <-w.wait():
|
|
|
|
+ // relock because of the defer
|
|
|
|
+ clnt.remote.Lock()
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
|
|
|