We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v1.46.0
go version
go version go1.17 darwin/amd64
MacOS
Run following code:
package main import ( "context" "log" "net/http" _ "net/http/pprof" "time" "google.golang.org/grpc" "google.golang.org/grpc/backoff" "google.golang.org/grpc/reflection/grpc_reflection_v1alpha" ) func main() { go func() { if err := http.ListenAndServe("127.0.0.1:9090", nil); err != nil { log.Fatalf("http err: %s", err) } }() del := 500 * time.Microsecond // Connection to this address should cause some error (connection refused, i/o timeout, etc) conn, err := grpc.Dial("127.0.0.1:12131", grpc.WithInsecure(), grpc.WithConnectParams( grpc.ConnectParams{ Backoff: backoff.Config{ BaseDelay: del, Multiplier: 1, Jitter: 0, MaxDelay: del, }, }, )) if err != nil { log.Fatalf("err: %s", err) } c := grpc_reflection_v1alpha.NewServerReflectionClient(conn) for { _, _ = c.ServerReflectionInfo(context.Background()) time.Sleep(del) } }
I did expect that this code doesn't cause memory leak.
This code leaks. Also, del could be decreased: this code will receive i/o timeout instead of connection refused, but will leak faster. Heap profile:
del
i/o timeout
connection refused
I've found that:
hctx
hcancel
onClose
newHTTP2Client
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
What version of gRPC are you using?
v1.46.0
What version of Go are you using (
go version
)?go version go1.17 darwin/amd64
What operating system (Linux, Windows, …) and version?
MacOS
What did you do?
Run following code:
What did you expect to see?
I did expect that this code doesn't cause memory leak.
What did you see instead?
This code leaks. Also,
del
could be decreased: this code will receivei/o timeout
instead ofconnection refused
, but will leak faster.Heap profile:
I've found that:
hctx
is allocated here.hcancel
is called inonClose
.onClose
is not called, ifnewHTTP2Client
fails before transport is created (here, for example).The text was updated successfully, but these errors were encountered: