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

Reset the stream when a response is completed before its corresponding response #6108

Merged
merged 3 commits into from
Feb 24, 2025

Conversation

jrhee17
Copy link
Contributor

@jrhee17 jrhee17 commented Feb 18, 2025

Motivation:

The motivation for this PR is better stated in #6104.

Modifications:

  • Modified so that when a request is aborted with a ResponseCompleteException, the stream is reset with CANCEL for http2 or the connection is closed for http1.

Result:

  • Connections do not hold references on automatically aborted requests, resulting in less memory pressure.

@jrhee17 jrhee17 added the defect label Feb 18, 2025
@jrhee17 jrhee17 added this to the 1.32.0 milestone Feb 18, 2025
@jrhee17 jrhee17 marked this pull request as ready for review February 19, 2025 00:55
Copy link
Contributor

@ikhoon ikhoon left a comment

Choose a reason for hiding this comment

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

It makes sense regarding the modifications made on the client side.

Server-side question) It could be unsafe to indefinitely wait for the client to send EOS in the half-closed (local) state.
Would it be reasonable to send RST_STREAM on the server side after requestAutoAbortDelay if the request remains open?

final Http2Error error;
if (Exceptions.isStreamCancelling(cause)) {
if (Exceptions.isStreamCancelling(cause) || cause instanceof ResponseCompleteException) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: cause instanceof ResponseCompleteException should be cheaper and is more likely to be called.

Suggested change
if (Exceptions.isStreamCancelling(cause) || cause instanceof ResponseCompleteException) {
if (cause instanceof ResponseCompleteException || Exceptions.isStreamCancelling(cause)) {

@ikhoon
Copy link
Contributor

ikhoon commented Feb 19, 2025

Would it be reasonable to send RST_STREAM on the server side after requestAutoAbortDelay if the request remains open?

/cc @minwoox Maybe he has some thoughts on that.

@minwoox
Copy link
Contributor

minwoox commented Feb 19, 2025

Would it be reasonable to send RST_STREAM on the server side after requestAutoAbortDelay if the request remains open?

That makes sense. 👍

@jrhee17
Copy link
Contributor Author

jrhee17 commented Feb 24, 2025

Server-side question) It could be unsafe to indefinitely wait for the client to send EOS in the half-closed (local) state.
Would it be reasonable to send RST_STREAM on the server side after requestAutoAbortDelay if the request remains open?

If you have an idea to handle this, feel free to do so. I don't think this issue is trivial, and I think some more time is needed to analyze/fix this issue.

@ikhoon
Copy link
Contributor

ikhoon commented Feb 24, 2025

Server-side question) It could be unsafe to indefinitely wait for the client to send EOS in the half-closed (local) state.
Would it be reasonable to send RST_STREAM on the server side after requestAutoAbortDelay if the request remains open?

If you have an idea to handle this, feel free to do so. I don't think this issue is trivial, and I think some more time is needed to analyze/fix this issue.

I didn't take a look at the problem in detail. It seems you have analyzed the issue more than I have, so I would like to ask you to handle it.

@minwoox
Copy link
Contributor

minwoox commented Feb 24, 2025

Let's handle the server-side issue separately. Thanks!

@minwoox minwoox merged commit db3e14a into line:main Feb 24, 2025
13 of 14 checks passed
jrhee17 added a commit that referenced this pull request Mar 4, 2025
…g response (#6108)

Motivation:

The motivation for this PR is better stated in #6104.

Modifications:

- Modified so that when a request is aborted with a `ResponseCompleteException`, the stream is reset with `CANCEL` for http2 or the connection is closed for http1.

Result:

- Connections do not hold references on automatically aborted requests, resulting in less memory pressure.

<!--
Visit this URL to learn more about how to write a pull request description:
https://armeria.dev/community/developer-guide#how-to-write-pull-request-description
-->
jrhee17 added a commit that referenced this pull request Mar 4, 2025
…g response (#6108)

Motivation:

The motivation for this PR is better stated in #6104.

Modifications:

- Modified so that when a request is aborted with a `ResponseCompleteException`, the stream is reset with `CANCEL` for http2 or the connection is closed for http1.

Result:

- Connections do not hold references on automatically aborted requests, resulting in less memory pressure.

<!--
Visit this URL to learn more about how to write a pull request description:
https://armeria.dev/community/developer-guide#how-to-write-pull-request-description
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants