From e4cb7b80d59a4154327ea96f4a040ef18ef90c5b Mon Sep 17 00:00:00 2001
From: gary rong <garyrong0905@gmail.com>
Date: Wed, 10 Apr 2019 16:47:09 +0800
Subject: [PATCH] rpc: cancel root context after all requests are served
 (#19430)

---
 rpc/handler.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rpc/handler.go b/rpc/handler.go
index 92db89e2f..02ab06b6d 100644
--- a/rpc/handler.go
+++ b/rpc/handler.go
@@ -151,8 +151,8 @@ func (h *handler) handleMsg(msg *jsonrpcMessage) {
 // call goroutines to shut down.
 func (h *handler) close(err error, inflightReq *requestOp) {
 	h.cancelAllRequests(err, inflightReq)
-	h.cancelRoot()
 	h.callWG.Wait()
+	h.cancelRoot()
 	h.cancelServerSubscriptions(err)
 }
 
-- 
GitLab