Skip to content

Fixes #13261 - Improve handling of failed HTTP/2 requests. #13267

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

Open
wants to merge 6 commits into
base: jetty-12.0.x
Choose a base branch
from

Conversation

sbordet
Copy link
Contributor

@sbordet sbordet commented Jun 20, 2025

No description provided.

sbordet added 5 commits June 19, 2025 22:53
…Connection, and HttpConnectionOver*.

Signed-off-by: Simone Bordet <[email protected]>
Signed-off-by: Simone Bordet <[email protected]>
…t in HttpSender to ensure that aborts always complete the CompletableFuture.

Signed-off-by: Simone Bordet <[email protected]>
* Reimplemented HttpConnectionOverHTTP2 using locking rather than concurrent data structures.
  This allows to control when send() is possible or not, with respect to the connection being closed or failed.
* Reimplemented HttpConnectionOverHTTP2 close() to call the low layer, while failures are called from the low layer.
  This allows to have the same code path, as it is always the low layer that drives.
* Reimplemented and simplified HTTP2Session failures of streams.
  Now failure paths properly use Callbacks, rather Callback.NOOP and sequential calls.

Signed-off-by: Simone Bordet <[email protected]>
@sbordet sbordet requested review from lorban and gregw June 20, 2025 22:21
@sbordet sbordet added Sponsored This issue affects a user with a commercial support agreement build-all-tests labels Jun 20, 2025
@sbordet sbordet moved this to 👀 In review in Jetty 12.0.23 Jun 20, 2025
@sbordet sbordet linked an issue Jun 20, 2025 that may be closed by this pull request
…f HTTP/2 stream failures.

Signed-off-by: Simone Bordet <[email protected]>
Copy link
Contributor

@gregw gregw left a comment

Choose a reason for hiding this comment

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

The fix looks good, with new calls to releaseConnection in places that look expected. However, some of the names and lack of comments are a little confusing, so a see comments for some suggestions to improve (but I approved this anyway).

@@ -388,8 +388,7 @@ private boolean process(Connection connection)
LOG.debug("Processing exchange {} on {} of {}", exchange, connection, this);
if (exchange == null)
{
if (!connectionPool.release(connection))
connection.close();
releaseConnection(connection);
Copy link
Contributor

Choose a reason for hiding this comment

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

The else clause below is not necessary and makes this code a little harder to read. Without it, it would be 4 if statements, each returning.

But this is unrelated to this PR

connection.close();
}
}

private boolean releaseConnection(Connection connection)
Copy link
Contributor

Choose a reason for hiding this comment

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

Two things confusing about this method on first glance:\

  • how is releaseConnection(Connection) different to releaseConnection(Connection)? Some better names and/or javadoc would help.
  • why is the connection closed if it is not released? If that is an unexpected situation, then a warn or debug would be good? A comment in the code to explain would be good. I'm assuming that a connection can be acquired multiple times due to multiplexing, so releasing to non-zero should be normal? or does the boolean return mean something else? Oh the boolean return from the release is special.

Maybe call this releaseOrClose(Connection), because either the connection is released or it is closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build-all-tests Sponsored This issue affects a user with a commercial support agreement
Projects
Status: 👀 In review
Development

Successfully merging this pull request may close these issues.

Improve handling of failed HTTP/2 requests
2 participants