Merge pull request #12797 from lzhfromustc/3_23

server/etcdmain and tests: Fix goroutine leaks
This commit is contained in:
Piotr Tabor 2021-05-10 08:29:17 +02:00 committed by GitHub
commit f5717016cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -218,7 +218,7 @@ func startGRPCProxy(cmd *cobra.Command, args []string) {
httpClient := mustNewHTTPClient(lg) httpClient := mustNewHTTPClient(lg)
srvhttp, httpl := mustHTTPListener(lg, m, tlsinfo, client, proxyClient) 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 <- newGRPCProxyServer(lg, client).Serve(grpcl) }()
go func() { errc <- srvhttp.Serve(httpl) }() go func() { errc <- srvhttp.Serve(httpl) }()
go func() { errc <- m.Serve() }() go func() { errc <- m.Serve() }()

View File

@ -258,7 +258,7 @@ func restoreCluster(t *testing.T, clusterN int, dbPath string) (
cfgs[i] = cfg cfgs[i] = cfg
} }
sch := make(chan *embed.Etcd) sch := make(chan *embed.Etcd, len(cfgs))
for i := range cfgs { for i := range cfgs {
go func(idx int) { go func(idx int) {
srv, err := embed.StartEtcd(cfgs[idx]) srv, err := embed.StartEtcd(cfgs[idx])