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

Proper fix for low-latency client streaming #6666

Closed
mholt opened this issue Oct 29, 2024 · 1 comment
Closed

Proper fix for low-latency client streaming #6666

mholt opened this issue Oct 29, 2024 · 1 comment
Labels
bug 🐞 Something isn't working
Milestone

Comments

@mholt
Copy link
Member

mholt commented Oct 29, 2024

In #4922 we had a request to leave the connection open to the backend when the client disconnects before the response (instead of immediately closing the upstream connection), so that the backend would finish receiving what the client sent, when the client doesn't care about the response.

This was implemented in #4952 by simply ignoring the context cancellation when connecting to the upstream when flush_interval is -1.

Obviously, in hindsight, this is flawed. Not only does it overload flush_interval in an incorrect and unexpected way, it leaves resources in use.

We had a sponsor report that gRPC connections with backends weren't being closed after clients disconnected, due to this patch. (Still being verified but seems quite probable.)

In 8c9e87d (not mainline branch) I separated flush_interval from a new option, ignore_client_gone that explicitly enables the behavior of leaving open the connection to the backend.

However, a proper fix is to have an option that, instead of just leaving the connection with the backend open until the backend decides it's done, will close the connection with the backend after it has received everything the client sent before it disconnected. If we mainline a change, I'd prefer it to be the proper fix.

@mholt mholt added bug 🐞 Something isn't working help wanted 🆘 Extra attention is needed labels Oct 29, 2024
mholt added a commit that referenced this issue Nov 12, 2024
…eam mode

i.e. Revert commit f5dce84

Two years ago, the patch in #4952 was a seemingly necessary way to fix an issue (sort of an edge case), but it broke other more common use cases (see #6666).

Now, as of #6669, it seems like the original issue can no longer be replicated, so we are reverting that patch, because it was incorrect anyway.

If it turns out the original issue returns, a more proper patch may be in #6669 (even if used as a baseline for a future fix). A potential future fix could be an opt-in setting.
@mholt
Copy link
Member Author

mholt commented Nov 12, 2024

Closing, since apparently the original issue in #4922 can no longer be replicated (see #6669), and the broken patch has been reverted instead.

@mholt mholt closed this as completed Nov 12, 2024
@mholt mholt removed the help wanted 🆘 Extra attention is needed label Nov 12, 2024
@mholt mholt modified the milestones: v2.9.0-beta.3, v2.9.0-beta.4 Nov 12, 2024
mholt added a commit that referenced this issue Nov 12, 2024
…eam mode

i.e. Revert commit f5dce84

Two years ago, the patch in #4952 was a seemingly necessary way to fix an issue (sort of an edge case), but it broke other more common use cases (see #6666).

Now, as of #6669, it seems like the original issue can no longer be replicated, so we are reverting that patch, because it was incorrect anyway.

If it turns out the original issue returns, a more proper patch may be in #6669 (even if used as a baseline for a future fix). A potential future fix could be an opt-in setting.
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
1 participant