square / wire

gRPC and protocol buffers for Android, Kotlin, Swift and Java.
https://square.github.io/wire/
Apache License 2.0
4.24k stars 570 forks source link

Mistakes in StreamingCalls. #2336

Open czf0613 opened 2 years ago

czf0613 commented 2 years ago

I have some problems when using wire in android. The prototype of my rpc is "single request" and "stream response", just like: rpc doSomething (XXXXrequest) returns (stream XXXXResponse)

But wire converted this rpc call into "Pair<SendChannel, ReceiveChannel>" in Kotlin, which seems to be a bi-direction streaming call, and my server returns an "502" status code.

Is there any solution? Thanks a lot!

oldergod commented 1 year ago

We have passing tests for this case https://github.com/square/wire/blob/master/wire-grpc-tests/src/test/java/com/squareup/wire/GrpcClientTest.kt#L302

I don't think it should be a problem if the client sends the request right away, is it?

sergei-lapin commented 11 months ago

Hey, @oldergod I've actually encountered this in a very weird way.

I have a server-streaming call and everything's OK if BE responds with proper response. But when request, for example, fails validation and BE responds with non-ok status — I receive 520 http code from the proxy (cloudflare). After few days of trial and error I started closing requests channel myself and it resulted in fixing the aforementioned behavior.

oldergod commented 11 months ago

Would you be able to write a failing test for this?