From 95f9bbf18b23cc6c7c7ce0c5a8a637bb1abfd59c Mon Sep 17 00:00:00 2001 From: Ace-Tang Date: Wed, 19 Jun 2019 12:57:51 +0800 Subject: [PATCH] Add timeout in load shim v2 add timeout in connect shim v2 avoid starting containerd hang Signed-off-by: Ace-Tang --- runtime/v2/shim.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runtime/v2/shim.go b/runtime/v2/shim.go index c652d3af5..a8efdbce3 100644 --- a/runtime/v2/shim.go +++ b/runtime/v2/shim.go @@ -100,6 +100,8 @@ func loadShim(ctx context.Context, bundle *Bundle, events *exchange.Exchange, rt events: events, rtTasks: rt, } + ctx, cancel := context.WithTimeout(ctx, 5*time.Second) + defer cancel() if err := s.Connect(ctx); err != nil { return nil, err }