From efc754f6b1f16142454953e813b4a66bd275ae85 Mon Sep 17 00:00:00 2001 From: "Yang, Wei" Date: Sun, 2 Jun 2019 17:03:20 +0800 Subject: [PATCH] containerd-shim-kata-v2: Use O_NONBLOCK for tty stdin. Fixes: #1659 our testing found that the client does not open stdin with O_WRONLY, so the shim v2 was blocked forever in open stdin with O_RDONLY. It's better to make it opened with O_NONBLOCK, and do not block starting process of container. and the containerd runc shim has done this by bc1ff514 as well. Signed-off-by: Yang, Wei Signed-off-by: Yang, Wei --- containerd-shim-v2/stream.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/containerd-shim-v2/stream.go b/containerd-shim-v2/stream.go index c64060ba88..e8c3b5c66f 100644 --- a/containerd-shim-v2/stream.go +++ b/containerd-shim-v2/stream.go @@ -56,7 +56,7 @@ func newTtyIO(ctx context.Context, stdin, stdout, stderr string, console bool) ( var err error if stdin != "" { - in, err = fifo.OpenFifo(ctx, stdin, syscall.O_RDONLY, 0) + in, err = fifo.OpenFifo(ctx, stdin, syscall.O_RDONLY|syscall.O_NONBLOCK, 0) if err != nil { return nil, err }