-
Notifications
You must be signed in to change notification settings - Fork 1.5k
speech: API is leaking connections #711
Copy link
Copy link
Closed
Labels
api: speechIssues related to the Speech-to-Text API.Issues related to the Speech-to-Text API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.Important issue which blocks shipping the next release. Will be fixed prior to next release.
Milestone
Metadata
Metadata
Labels
api: speechIssues related to the Speech-to-Text API.Issues related to the Speech-to-Text API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.Important issue which blocks shipping the next release. Will be fixed prior to next release.
I am using Speech API v0.10.0 and running into open connections in my client. I am using the following stub code:
main() {
....
477 ctx := context.Background()
478 // Create a google speech API client
479 client, err = speech.NewClient(ctx, option.WithServiceAccountFile(os.Getenv("GOOGLE_APPLICATION_CREDENTIALS")))
480 if err != nil {
481 log.Println("Err: Cannot create speech client")
482 return
483 }
484 defer client.Close()
}
116 ctx := context.Background()
117 speechStream, err := client.StreamingRecognize(ctx)
I call the following when I finish reading audio like this:
264 err := speechStream.CloseSend()
265 if err != nil {
266 log.Printf("CloseSend failed due to %+v", err)
267 }
I am consistently seeing that CloseSend succeeds (err is nil) but I keep having a increase in number of connections. I tried to GRPC debug this before coming here: grpc/grpc-go#1402
Reading from above issue it looks like creating a new RPC should not always mean creating a new connection. Although, the way I am leaking it looks like each streaming RPC is leaking a dangling client connection. Other notes:
Is this the right way to go around the 55 sec deadline when doing transcription? Is there any behavior of closing streams down that I am not handling properly?