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

Change in behavior of streaming request body (1.4.1 vs 1.8.1) #894

Closed
happyalu opened this issue Mar 5, 2019 · 2 comments
Closed

Change in behavior of streaming request body (1.4.1 vs 1.8.1) #894

happyalu opened this issue Mar 5, 2019 · 2 comments

Comments

@happyalu
Copy link
Contributor

happyalu commented Mar 5, 2019

Steps you follow to reproduce the error:

I was using grpc-gateway (1.4.1) with github.com/tmc/grpc-websocket-proxy for using websockets to do bidirectional streaming. I recently updated to 1.8.1 and noticed that my web client was not behaving as expected. Further analysis showed that:

  • the websocket proxy was reading messages from the browser appropriately and forwarding them to grpc-gateway,
  • my grpc server was not receiving any messages.

I also saw that this issue has been reported on the websocket-proxy project.

It seems that the communication between the websocket proxy and the grpc server is blocked by ioutil.ReadAll. If I used a modified websocket proxy code that closes the request body after a few messages, the grpc server receives all the messages.

What did you expect to happen instead:

The grpc server should receive each message as the websocket sends it.

What's your theory on why it isn't working:

This does seem to be related to the ioutil.ReadAll on the request Body.

@johanbrandhorst
Copy link
Collaborator

Thanks for reporting this bug, as discussed this should be fairly easily resolved for the bidi and client streaming case by not using the ReaderUtil method (since we don't need it there anyway).

@johanbrandhorst
Copy link
Collaborator

See tmc/grpc-websocket-proxy#14 (comment) for more information.

johanbrandhorst pushed a commit that referenced this issue Mar 6, 2019
An IOReaderFactory was being used to wrap request body for client/bidi streaming
requests.  This was causing the requests to be fully buffered before being sent
to the grpc server, thereby breaking streaming.  This commit changes that to
directly use request body.

Fixes #894
adasari pushed a commit to adasari/grpc-gateway that referenced this issue Apr 9, 2020
An IOReaderFactory was being used to wrap request body for client/bidi streaming
requests.  This was causing the requests to be fully buffered before being sent
to the grpc server, thereby breaking streaming.  This commit changes that to
directly use request body.

Fixes grpc-ecosystem#894
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants