From 3de6b382dfcb2ce5cd4820808f0edbeb5bb3a166 Mon Sep 17 00:00:00 2001 From: lzhfromustc Date: Tue, 23 Mar 2021 12:52:59 -0400 Subject: [PATCH] server&tests: Fix goroutine leaks --- server/etcdmain/grpc_proxy.go | 2 +- tests/integration/snapshot/v3_snapshot_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/etcdmain/grpc_proxy.go b/server/etcdmain/grpc_proxy.go index 859d99f4c..c5fa00cb1 100644 --- a/server/etcdmain/grpc_proxy.go +++ b/server/etcdmain/grpc_proxy.go @@ -218,7 +218,7 @@ func startGRPCProxy(cmd *cobra.Command, args []string) { httpClient := mustNewHTTPClient(lg) srvhttp, httpl := mustHTTPListener(lg, m, tlsinfo, client, proxyClient) - errc := make(chan error) + errc := make(chan error, 3) go func() { errc <- newGRPCProxyServer(lg, client).Serve(grpcl) }() go func() { errc <- srvhttp.Serve(httpl) }() go func() { errc <- m.Serve() }() diff --git a/tests/integration/snapshot/v3_snapshot_test.go b/tests/integration/snapshot/v3_snapshot_test.go index b4fbbd6fc..f69f2161e 100644 --- a/tests/integration/snapshot/v3_snapshot_test.go +++ b/tests/integration/snapshot/v3_snapshot_test.go @@ -260,7 +260,7 @@ func restoreCluster(t *testing.T, clusterN int, dbPath string) ( cfgs[i] = cfg } - sch := make(chan *embed.Etcd) + sch := make(chan *embed.Etcd, len(cfgs)) for i := range cfgs { go func(idx int) { srv, err := embed.StartEtcd(cfgs[idx])