You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having trouble with implementing the following logic with gRPC streams:
I have a client that sometimes calls Recv() on a gRPC stream and this invocation of Recv() should block until a message is received from the server.
However, sometimes I want the client to abort the Recv() invocation.
In order to do so, I have implemented another call that runs from a different goroutine, and simply calls Close() on the connection that the client stream was created with.
I've noticed that sometimes (although rarely) - the Recv() method gets stuck even though Close() was called after.
I had success with reproducing this issue in the attached link.
Could it be that closing the connection isn't supposed to make the Recv() method return, and the "right" way to do it is with context.WithCancel ?
Hi.
I'm having trouble with implementing the following logic with gRPC streams:
I have a client that sometimes calls Recv() on a gRPC stream and this invocation of Recv() should block until a message is received from the server.
However, sometimes I want the client to abort the Recv() invocation.
In order to do so, I have implemented another call that runs from a different goroutine, and simply calls Close() on the connection that the client stream was created with.
I've noticed that sometimes (although rarely) - the Recv() method gets stuck even though Close() was called after.
I had success with reproducing this issue in the attached link.
Could it be that closing the connection isn't supposed to make the Recv() method return, and the "right" way to do it is with context.WithCancel ?
What version of gRPC are you using?
Not sure, the commit hash is:
commit 4acc910
What version of Go are you using (
go version
)?go version go1.7.1 linux/amd64
What operating system (Linux, Windows, …) and version?
Description: Ubuntu 14.04.5 LTS
What did you do?
Provided a test that from 1 goroutine calls Recv() and then after 500ms calls Close() on the underlying connection.
Sometimes, the Recv() method doesn't return after the Close() is called.
https://gist.github.com/yacovm/a39409305056fa36abb9ed849b6b9770
What did you expect to see?
I expect Recv() to always return when Close() is called
What did you see instead?
Sometimes Recv() is stuck.
The text was updated successfully, but these errors were encountered: