From 7b7feb46fcf13da75f93797740ffc6034bb585ff Mon Sep 17 00:00:00 2001 From: fanmin shi Date: Fri, 16 Dec 2016 17:11:23 -0800 Subject: [PATCH] leasehttp: buffer error channel to prevent goroutine leak --- lease/leasehttp/http.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lease/leasehttp/http.go b/lease/leasehttp/http.go index 5e4afde54..256051efc 100644 --- a/lease/leasehttp/http.go +++ b/lease/leasehttp/http.go @@ -206,7 +206,8 @@ func TimeToLiveHTTP(ctx context.Context, id lease.LeaseID, keys bool, url string cc := &http.Client{Transport: rt} var b []byte - errc := make(chan error) + // buffer errc channel so that errc don't block inside the go routinue + errc := make(chan error, 2) go func() { resp, err := cc.Do(req) if err != nil {