Skip to content
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

Generated client stubs for bidirectional streaming service does not appear to exert back-pressure on send #581

Open
SoftMemes opened this issue Mar 15, 2024 · 1 comment
Assignees

Comments

@SoftMemes
Copy link

I have a bidirectional streaming service and want the client to block rather than buffer when producing requests. According to #385, this should be supported, but this does not appear to be the case.

I have been able to test this by pausing the remote gRPC service, and observe that the client still pulls from the request flow, rather than stop consuming from the flow until messages have been received by the remote.

I have traced this to https://github.com/grpc/grpc-kotlin/blob/master/stub/src/main/java/io/grpc/kotlin/ClientCalls.kt#L249. I note that there's a check here for readiness, but this appears to be checked only once - there is no way for the readiness instance to go from "ready" to "not ready", so the streaming sender currently never suspends.

Is this intended/expected behaviour?

@lowasser
Copy link
Collaborator

I'm not sure I follow how you're reading the code. The conflated channel in the Readiness goes from ready to not-ready whenever the single element in the channel is received, and the code in ClientCalls that you point out waits for readiness before collecting the first element from requestFlow, and again after sending each element before returning control to requestFlow to collect the next one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants