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

Connect unary should return unavailable instead of unimplemented for io.EOF errors from the transport #776

Merged
merged 2 commits into from
Sep 17, 2024

Conversation

jhump
Copy link
Member

@jhump jhump commented Sep 13, 2024

This adds a test that can reproduce the issue where unary RPCs would return an unimplemented code when an unavailable code was more appropriate. Basically, it was mistakenly interpreting network EOF errors as "the server did not send us any response messages which is cardinality violation" instead of "the server connection broke so the server response is unavailable".

There are still cases where an io.EOF could likely be misinterpreted as a cardinality issue: if it the connection is severed after the headers have been received but before the first byte of the first envelope has been received. But the main case where this issue has been reported was for unary RPCs in the Connect protocol, which does not suffer from that issue, since it does not use envelopes.

So this isn't 100% perfect, but it gets us closer and likely fixes most of the issues in practice. So while it doesn't fully resolve #774, it should help a lot.

…IO errors from transport

Signed-off-by: Josh Humphries <2035234+jhump@users.noreply.github.com>
@jhump jhump force-pushed the jh/connect-unary-eof-should-be-unavailable branch from f549191 to cd5a72e Compare September 13, 2024 17:31
Signed-off-by: Josh Humphries <2035234+jhump@users.noreply.github.com>
Comment on lines -22 to -23
- pkg: connectrpc.com/connect
alias: connect
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since v1.11.0 (the move to the connectrpc.com domain), it is no longer necessary/helpful to always have an import alias here. So I've removed this requirement and removed the (superfluous) alias in the file I touched below.

duplex_http_call.go Show resolved Hide resolved
client_ext_test.go Show resolved Hide resolved
@jhump
Copy link
Member Author

jhump commented Sep 16, 2024

@emcfarlane, I think you are suggesting a different approach other than replacing the io.EOF root error. I'll try to push something different and see if you like it better.

@emcfarlane
Copy link
Contributor

@jhump comments were only nits, i've resolved.

@jhump
Copy link
Member Author

jhump commented Sep 17, 2024

@jhump comments were only nits, i've resolved.

Thanks. But I went ahead and pushed an alternative (#777) just to see if you like it better. Let me know.

@jhump jhump merged commit c8be9e7 into main Sep 17, 2024
14 checks passed
@jhump jhump deleted the jh/connect-unary-eof-should-be-unavailable branch September 17, 2024 20:23
@jhump jhump added the bug Something isn't working label Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

unary response has zero messages due to io.EOF for all io.EOF errors
2 participants