From b3438f7a6f63849d2179a2a76b804aea460affd9 Mon Sep 17 00:00:00 2001 From: Lifubang Date: Sun, 18 Nov 2018 09:00:25 +0800 Subject: [PATCH] fix pipe in broken may cause shim lock forever for runtime v2 Signed-off-by: Lifubang --- runtime/v2/runc/service_linux.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/runtime/v2/runc/service_linux.go b/runtime/v2/runc/service_linux.go index 5e30cfcb3..19d1fec7d 100644 --- a/runtime/v2/runc/service_linux.go +++ b/runtime/v2/runc/service_linux.go @@ -49,9 +49,10 @@ func (p *linuxPlatform) CopyConsole(ctx context.Context, console console.Console cwg.Add(1) go func() { cwg.Done() - p := bufPool.Get().(*[]byte) - defer bufPool.Put(p) - io.CopyBuffer(epollConsole, in, *p) + bp := bufPool.Get().(*[]byte) + defer bufPool.Put(bp) + io.CopyBuffer(epollConsole, in, *bp) + epollConsole.Shutdown(p.epoller.CloseConsole) }() }