Browse code

daemon: Daemon.killWithSignal(): don't discard handleContainerExit error

Daemon.handleContainerExit() returns an error if snapshotting the container's
state to disk fails. There's not much we can do with the error if it occurs,
but let's log the error if that happens, instead of discarding it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2023/08/14 23:15:07
Showing 1 changed files
... ...
@@ -111,7 +111,13 @@ func (daemon *Daemon) killWithSignal(container *containerpkg.Container, stopSign
111 111
 				defer cancel()
112 112
 				s := <-container.Wait(ctx, containerpkg.WaitConditionNotRunning)
113 113
 				if s.Err() != nil {
114
-					daemon.handleContainerExit(container, nil)
114
+					if err := daemon.handleContainerExit(container, nil); err != nil {
115
+						log.G(context.TODO()).WithFields(log.Fields{
116
+							"error":     err,
117
+							"container": container.ID,
118
+							"action":    "kill",
119
+						}).Warn("error while handling container exit")
120
+					}
115 121
 				}
116 122
 			}()
117 123
 		} else {