danielgtaylor / python-betterproto

Clean, modern, Python 3.6+ code generator & library for Protobuf 3 and async gRPC
MIT License
1.5k stars 210 forks source link

unary_stream message issue #430

Open AlexanderZender opened 1 year ago

AlexanderZender commented 1 year ago

I'm currently facing the issue that a unary_stream connection does not behave as I would expect. (betterproto version b5)

Client code:

image

Server code:

image image

Opening the connection works fine, the server receives the request and begins its job. The task the server performs is taking 1 min +/-, during that time it sends multiple responses to the client. While debugging I could see that subroutines have been executed and sending data (server side).

But nothing arrives at the client, the red X located at the client if statement is a breakpoint that never executes until after the server method returns. If I breakpoint the server at its last statement (red X) the client is idle. Only after continuing, allowing the server to complete the method (closing the connection?), within the client program the subroutines trigger: image

All messages then are 'spammed' to the waiting client. At first glance, nothing is missing, but I expected the stream to work like in the default google implementation. Receiving the messages one after another when sent from the server. Is this intended behavior?

AlexanderZender commented 1 year ago

Adding to above, the same issue occurs when using a stream_stream connection. the client is stuck waiting until the server closes the connection, I wonder if the server actually send messages before closing?