-
Notifications
You must be signed in to change notification settings - Fork 2
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
Fetch status from either headers or trailers #5
Conversation
Brilliant, thank you! @mbacarella can you confirm this works for your case?
I wonder if we should provision for that. It's unlikely to happen with a well-behaved gRPC server, but we should probably raise an exception. Hanging silently doesn't seem like the right thing to do when we have consumed the entire body and are not waiting for anything anymore. What do you think? |
Thank you for raising the issue! About the case of no I suggest we don't raise, given that in https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#responses it says: |
@doctor-pi do you use discord? We have a discord group for contributors. Feel free to message me on discord @wokalski to add you to it. The group is not too active/spammy but it might be useful from time to time! After this pull request gets merged, I will push it to dialohq/ocaml-grpc and archive this repo. |
Good call. I hadn't noticed this scenario was actually part of the specification. |
Closes dialohq/ocaml-grpc#1 for Lwt & Async.
In summary, to deal with "trailers-only" responses, we apply
trailers_handler
also to the headers. This seems to successfully solve the situation in which some calls hang, as reported in #2.Although we should reasonably assume that a response will not contain
grpc-status
in both headers and trailers, in the unlikely event that a server has this behaviour, no exception will be raised. However, only one status will be recorded.In the event that there is no status at all, the call can still hang. However, this is unlikely.