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

H3: rework exception handling #10583

Closed
lorban opened this issue Sep 26, 2023 · 1 comment
Closed

H3: rework exception handling #10583

lorban opened this issue Sep 26, 2023 · 1 comment
Assignees
Labels
Bug For general bugs on Jetty side
Milestone

Comments

@lorban
Copy link
Contributor

lorban commented Sep 26, 2023

Jetty version(s)
12.0.x

Description

In #10543 the stack overflow in HttpStreamOverHTTP3.consumeAvailable() was worked around by setting an error chunk in onFailure. As a reminder, here is the relevant part of the stack where the infinite loop happened:

	at org.eclipse.jetty.http3.server.internal.HTTP3StreamServer.notifyFailure(HTTP3StreamServer.java:129)
	at org.eclipse.jetty.http3.HTTP3Stream.onFailure(HTTP3Stream.java:375)
	at org.eclipse.jetty.http3.HTTP3Session.onStreamFailure(HTTP3Session.java:843)
	at org.eclipse.jetty.http3.HTTP3StreamConnection.processDataFrames(HTTP3StreamConnection.java:146)
	at org.eclipse.jetty.http3.HTTP3StreamConnection.receive(HTTP3StreamConnection.java:242)
	at org.eclipse.jetty.http3.HTTP3Stream.readData(HTTP3Stream.java:178)
	at org.eclipse.jetty.http3.server.internal.HttpStreamOverHTTP3.read(HttpStreamOverHTTP3.java:150)
	at org.eclipse.jetty.server.HttpStream.consumeAvailable(HttpStream.java:117)
	at org.eclipse.jetty.http3.server.internal.HttpStreamOverHTTP3.consumeAvailable(HttpStreamOverHTTP3.java:490)
	at org.eclipse.jetty.server.internal.HttpChannelState.onFailure(HttpChannelState.java:492)
	at org.eclipse.jetty.http3.server.internal.HttpStreamOverHTTP3.onFailure(HttpStreamOverHTTP3.java:531)
	at org.eclipse.jetty.http3.server.internal.ServerHTTP3StreamConnection.onFailure(ServerHTTP3StreamConnection.java:82)
	at org.eclipse.jetty.http3.server.HTTP3ServerConnectionFactory$HTTP3StreamListener.onFailure(HTTP3ServerConnectionFactory.java:164)
	at org.eclipse.jetty.http3.server.internal.HTTP3StreamServer.notifyFailure(HTTP3StreamServer.java:129)

The root cause of the infinite loop is that HTTP3StreamConnection.fill() rethrows a RuntimeException when the underlying EndPoint.fill() call throws IOException, unlike H1 where HttpConnection.fillRequestBuffer() catches IOException and returns -1. So eventually HTTPStreamOverHttp3.read() throws instead of returning an error chunk, which ends up calling HttpChannelState.onFailure() which calls HttpStreamOverHTTP3.consumeAvailable() and we get that infinite loop that leads to a stack overflow.

Unfortunately, some tests (org.eclipse.jetty.http3.tests.ClientServerTest.testResponseHeadersTooLarge(), org.eclipse.jetty.http3.tests.StreamIdleTimeoutTest.testClientStreamIdleTimeout() and org.eclipse.jetty.http3.tests.StreamIdleTimeoutTest.testServerStreamIdleTimeout()) rely on this exception being thrown.

This all needs to be reworked so that the temporary fix made in #10543 isn't needed anymore.

@lorban lorban added the Bug For general bugs on Jetty side label Sep 26, 2023
@lorban lorban added this to the 12.0.x milestone Sep 26, 2023
@lorban lorban self-assigned this Sep 26, 2023
@lorban
Copy link
Contributor Author

lorban commented Jul 2, 2024

The changes done in #10431 and #11897 made this obsolete.

@lorban lorban closed this as completed Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For general bugs on Jetty side
Projects
No open projects
Status: ✅ Done
Development

No branches or pull requests

1 participant