From c081d78f0c65049309d706e956ac4097774367d5 Mon Sep 17 00:00:00 2001 From: Lei Jitang Date: Tue, 29 Nov 2016 20:41:39 -0500 Subject: [PATCH 1/2] Ignore "failed to close stdin" if container or process not found Signed-off-by: Lei Jitang Upstream-commit: 9aedaf5b3acc0dd0df4a4b67c46cf922d42f62a3 Component: engine --- components/engine/libcontainerd/process_unix.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/engine/libcontainerd/process_unix.go b/components/engine/libcontainerd/process_unix.go index e3d8c5f34a..514ebf643c 100644 --- a/components/engine/libcontainerd/process_unix.go +++ b/components/engine/libcontainerd/process_unix.go @@ -8,6 +8,7 @@ import ( "os" "path/filepath" goruntime "runtime" + "strings" "time" containerd "github.com/docker/containerd/api/grpc/types" @@ -86,6 +87,9 @@ func (p *process) sendCloseStdin() error { Pid: p.friendlyName, CloseStdin: true, }) + if err != nil && (strings.Contains(err.Error(), "container not found") || strings.Contains(err.Error(), "process not found")) { + return nil + } return err } From 3723431bd09f6285aae009063aedfd15f2a9bf32 Mon Sep 17 00:00:00 2001 From: Lei Jitang Date: Mon, 28 Nov 2016 20:31:59 -0500 Subject: [PATCH 2/2] Change Error log to Warning when close stdin fail Signed-off-by: Lei Jitang Upstream-commit: 37db0220452a837791af84d044b0b308260dccec Component: engine --- components/engine/container/stream/streams.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/engine/container/stream/streams.go b/components/engine/container/stream/streams.go index a45e31f211..79f366afda 100644 --- a/components/engine/container/stream/streams.go +++ b/components/engine/container/stream/streams.go @@ -135,7 +135,7 @@ func (c *Config) CopyToPipe(iop libcontainerd.IOPipe) { go func() { pools.Copy(iop.Stdin, stdin) if err := iop.Stdin.Close(); err != nil { - logrus.Errorf("failed to close stdin: %+v", err) + logrus.Warnf("failed to close stdin: %+v", err) } }() }