Merge pull request #980 from unistack-org/issue-940

grpc client goroutine leak fix
This commit is contained in:
Asim Aslam 2019-11-25 19:10:34 +00:00 committed by GitHub
commit db03a564fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,16 +43,14 @@ func (g *grpcStream) Send(msg interface{}) error {
func (g *grpcStream) Recv(msg interface{}) (err error) {
defer g.setError(err)
if err = g.stream.RecvMsg(msg); err != nil {
if err == io.EOF {
// #202 - inconsistent gRPC stream behavior
// the only way to tell if the stream is done is when we get a EOF on the Recv
// here we should close the underlying gRPC ClientConn
closeErr := g.conn.Close()
if closeErr != nil {
if err == io.EOF && closeErr != nil {
err = closeErr
}
}
}
return
}