-
-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
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
Python client receives out-of-order stream #611
Comments
I was able to reproduce - looks like it's fairly common for messages to go out of order when streaming. Testing this with |
The main difference with |
I've been playing with it for a while and it is hard to reproduce on my end. But what I noticed is that this is definitely not a bug in this library. To check this I changed the handler to:
and then the user code stops when finding a reproducer:
What I observed is that:
and
I also note that the bug only happens (at least for me) when using Anyway, this appears to be a bug in the stream runtime and it will be fun to find it 🤠 |
that's because |
Isn't it because of |
Small reproducer using zio only: import zio.*
import zio.stream.*
object Test extends ZIOAppDefault {
val expected = Chunk.fromIterable(0 until 100)
val s = ZStream.fromChunk(expected).buffer(16)
def run = s.runCollect.map(_ == expected).debug.repeatWhile(identity)
} It seems to work without |
I had added a |
Speaking of |
I actually added #578 to not buffer at all 😆 But yeah |
The ordering issue on zio side was fixed so I think this is resolved. |
Hi all, I have a server implemented in Scala using zio-grpc, and a client in Python.
I found that sometimes the stream received by the client is out of order. For example, the sequence of data sent by the server is
[1, 2, 3, 4, 5]
, but those received by the client are[1, 2, 4, 3, 5]
. Though I'm new to grpc, I don't think this is an expected behavior.Here is a minimal example: https://drive.google.com/file/d/1Eew2sOhjSt2tCBEupE1glo6PALYkB0t1/view
According to my testing results, this happens rarely (with
n=10000
this will almost always happen), and usually only one or two pairs of adjacent items are swapped.I'm not sure if this problem is with zio-grpc or Pyhton's grpcio, below is some relevant information:
OS: Ubuntu 22.04
Python version: 3.10.13
grpcio version: 1.51.1 (couldn't find 1.50.1)
grpcio-tools version: 1.51.1
grpc version: 4.25.3
Scala version: 2.13.13
grpc-netty version: 1.50.1
The text was updated successfully, but these errors were encountered: