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

Distinguish between "the server ended the stream" and "the connection dropped unexpectedly" #397

Closed
haines opened this issue Nov 18, 2022 · 3 comments · Fixed by #533
Closed
Labels
enhancement New feature or request

Comments

@haines
Copy link

haines commented Nov 18, 2022

Is your feature request related to a problem? Please describe.

We're using the connect protocol to stream messages from a server to a client. I seem to have misconfigured the reverse proxy in between them, so the connection drops after 30 seconds.

What surprised me, though, was that in this case (*ServerStreamForClient).Err() returns nil, even though the client never received the end-of-stream message.

It seems like when the connection dropped unexpectedly, the client receives an io.EOF, which is suppressed.

If the server closed the stream and the client received the end-of-stream message, then the error is errSpecialEnvelope, which is also suppressed since it wraps io.EOF.

It seems like it's not possible to distinguish between "the server ended the stream" and "the connection dropped unexpectedly".

Describe the solution you'd like

I would like (*ServerStreamForClient).Err() to only return nil if the client received the end-of-stream message from the server. If the client received io.EOF before receiving the end-of-stream message, then I would like it to return the error.

@haines haines added the enhancement New feature or request label Nov 18, 2022
@akshayjshah
Copy link
Member

Great point, @haines! We'll take a look and see how we can fix this.

@akshayjshah akshayjshah added bug Something isn't working and removed bug Something isn't working labels May 8, 2023
emcfarlane referenced this issue Jun 28, 2023
Capture unexpected io.EOF errors as io.ErrUnexpectedEOF in client streams. Now raises an error when the stream doesn't end with an end response message.

Fixes https://github.com/bufbuild/connect-go/issues/397
@emcfarlane
Copy link
Contributor

@haines client streams will now error with io.ErrUnexpectedEOF on dropped connections.

@haines
Copy link
Author

haines commented Jun 28, 2023

Awesome, thanks @emcfarlane!

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

Successfully merging a pull request may close this issue.

3 participants