diff options
author | Valentin Rothberg <rothberg@redhat.com> | 2020-01-31 14:59:49 +0100 |
---|---|---|
committer | Valentin Rothberg <rothberg@redhat.com> | 2020-01-31 16:13:00 +0100 |
commit | 868ee6db7057a63e09dc67b7448a6f13efcdddd3 (patch) | |
tree | 17158d0452a78b353675638a3ad3741329775f4b | |
parent | 36af2833f954e1c822b917ecff45c05858188c2d (diff) | |
download | podman-868ee6db7057a63e09dc67b7448a6f13efcdddd3.tar.gz podman-868ee6db7057a63e09dc67b7448a6f13efcdddd3.tar.bz2 podman-868ee6db7057a63e09dc67b7448a6f13efcdddd3.zip |
sigproxy: return after closing the channel
When stopping signal handling (e.g., to properly handle ^C) we are also
closing the signal channel. We should really return from the go-routine
instead of continuing and risking double-closing the channel which leads
to a panic.
Fixes: #5034
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
-rw-r--r-- | pkg/adapter/sigproxy_linux.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/pkg/adapter/sigproxy_linux.go b/pkg/adapter/sigproxy_linux.go index ebfeab725..35745a6aa 100644 --- a/pkg/adapter/sigproxy_linux.go +++ b/pkg/adapter/sigproxy_linux.go @@ -25,11 +25,17 @@ func ProxySignals(ctr *libpod.Container) { } if err := ctr.Kill(uint(s.(syscall.Signal))); err != nil { + // If the container dies, and we find out here, + // we need to forward that one signal to + // ourselves so that it is not lost, and then + // we terminate the proxy and let the defaults + // play out. logrus.Errorf("Error forwarding signal %d to container %s: %v", s, ctr.ID(), err) signal.StopCatch(sigBuffer) if err := syscall.Kill(syscall.Getpid(), s.(syscall.Signal)); err != nil { logrus.Errorf("failed to kill pid %d", syscall.Getpid()) } + return } } }() |