mirror of
https://github.com/containers/podman.git
synced 2025-06-23 02:18:13 +08:00
Merge pull request #8191 from mheon/no_error_on_sigproxy_stopped
When container stops, drop sig-proxy errors to infos
This commit is contained in:
@ -5,8 +5,10 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/containers/podman/v2/libpod"
|
"github.com/containers/podman/v2/libpod"
|
||||||
|
"github.com/containers/podman/v2/libpod/define"
|
||||||
"github.com/containers/podman/v2/libpod/shutdown"
|
"github.com/containers/podman/v2/libpod/shutdown"
|
||||||
"github.com/containers/podman/v2/pkg/signal"
|
"github.com/containers/podman/v2/pkg/signal"
|
||||||
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -33,12 +35,16 @@ func ProxySignals(ctr *libpod.Container) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := ctr.Kill(uint(s.(syscall.Signal))); err != nil {
|
if err := ctr.Kill(uint(s.(syscall.Signal))); err != nil {
|
||||||
|
if errors.Cause(err) == define.ErrCtrStateInvalid {
|
||||||
|
logrus.Infof("Ceasing signal forwarding to container %s as it has stopped", ctr.ID())
|
||||||
|
} else {
|
||||||
|
logrus.Errorf("Error forwarding signal %d to container %s: %v", s, ctr.ID(), err)
|
||||||
|
}
|
||||||
// If the container dies, and we find out here,
|
// If the container dies, and we find out here,
|
||||||
// we need to forward that one signal to
|
// we need to forward that one signal to
|
||||||
// ourselves so that it is not lost, and then
|
// ourselves so that it is not lost, and then
|
||||||
// we terminate the proxy and let the defaults
|
// we terminate the proxy and let the defaults
|
||||||
// play out.
|
// play out.
|
||||||
logrus.Errorf("Error forwarding signal %d to container %s: %v", s, ctr.ID(), err)
|
|
||||||
signal.StopCatch(sigBuffer)
|
signal.StopCatch(sigBuffer)
|
||||||
if err := syscall.Kill(syscall.Getpid(), s.(syscall.Signal)); err != nil {
|
if err := syscall.Kill(syscall.Getpid(), s.(syscall.Signal)); err != nil {
|
||||||
logrus.Errorf("failed to kill pid %d", syscall.Getpid())
|
logrus.Errorf("failed to kill pid %d", syscall.Getpid())
|
||||||
|
Reference in New Issue
Block a user