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

Make AsyncResponse aware of the client disconnection #22440

Merged
merged 1 commit into from
Jun 20, 2024

Conversation

wendigo
Copy link
Contributor

@wendigo wendigo commented Jun 19, 2024

With the current Jersey and Jetty implementations @suspended AsyncResponse can generate a lot of warnings that are caused by the fact that Jetty eagerly recycles request/response objects when the HTTP/2 RST_STREAM frame is sent by the client during request aborting.

We abort in-flight requests for different reasons: either timeout is reached or when the client is closed during cleanup.

For HTTP/1 that doesn't matter, but for HTTP/2 this will cause the AsyncResponse.resume to log an error, since the underlying request/response objects are already recycled and there is no client listening for the response.

This change also cancels Future<?> bound to the AsyncContext since there is no point in processing it anymore.

Description

Additional context and related issues

Release notes

( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text:

# Section
* Fix some things. ({issue}`issuenumber`)

@wendigo
Copy link
Contributor Author

wendigo commented Jun 19, 2024

This is a preparation for HTTP/2 enabled internally

@wendigo wendigo force-pushed the serafin/async-disconnection branch 2 times, most recently from 42b26bb to f12a09f Compare June 19, 2024 12:57
@wendigo wendigo requested a review from martint June 19, 2024 16:35
With the current Jersey and Jetty implementations @suspended AsyncResponse
can generate a lot of warnings that are caused by the fact that Jetty eagerly recycles
request/response objects when the HTTP/2 RST_STREAM frame is sent by the client during request aborting.

We abort in-flight requests for different reasons: either timeout is reached or when the client is closed during cleanup.

For HTTP/1 that doesn't matter, but for HTTP/2 this will cause the AsyncResponse.resume to log an error,
since the underlying request/response objects are already recycled and there is no client listening for the response.

This change also cancels Future<?> bound to the AsyncContext since there is no point in processing it anymore.
@wendigo wendigo force-pushed the serafin/async-disconnection branch from f12a09f to 1c733fa Compare June 19, 2024 22:26
@wendigo wendigo merged commit 4805b77 into master Jun 20, 2024
103 of 104 checks passed
@wendigo wendigo deleted the serafin/async-disconnection branch June 20, 2024 04:58
@github-actions github-actions bot added this to the 451 milestone Jun 20, 2024
@colebow colebow added the no-release-notes This pull request does not require release notes entry label Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed no-release-notes This pull request does not require release notes entry
Development

Successfully merging this pull request may close these issues.

None yet

3 participants