From 3d900051b6c1c7da078eba0689b06c2b3e5c729f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kenfe-Micka=C3=ABl=20Laventure?= Date: Thu, 9 Jun 2016 14:36:42 -0700 Subject: [PATCH] Fix panic within ctr if the daemon dies while attached to a container (#264) Signed-off-by: Kenfe-Mickael Laventure --- ctr/container.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ctr/container.go b/ctr/container.go index d3d8f8e74..7edb675fe 100644 --- a/ctr/container.go +++ b/ctr/container.go @@ -22,6 +22,7 @@ import ( netcontext "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/transport" ) // TODO: parse flags and pass opts @@ -638,6 +639,10 @@ func waitForExit(c types.APIClient, events types.API_EventsClient, id, pid strin for { e, err := events.Recv() if err != nil { + if grpc.ErrorDesc(err) == transport.ErrConnClosing.Desc { + closer() + os.Exit(128 + int(syscall.SIGHUP)) + } time.Sleep(1 * time.Second) events, _ = c.Events(netcontext.Background(), &types.EventsRequest{Timestamp: timestamp}) continue