This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push: new b062f569e3 Improve handling of unexpected errors during HTTP/2 processing b062f569e3 is described below commit b062f569e31501e2c5c334ffa877b19b9ea63492 Author: Mark Thomas <ma...@apache.org> AuthorDate: Wed Mar 19 03:47:11 2025 +0000 Improve handling of unexpected errors during HTTP/2 processing --- java/org/apache/coyote/http2/Http2UpgradeHandler.java | 8 ++++++++ java/org/apache/coyote/http2/LocalStrings.properties | 1 + webapps/docs/changelog.xml | 3 +++ 3 files changed, 12 insertions(+) diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java b/java/org/apache/coyote/http2/Http2UpgradeHandler.java index 823addd6f3..81dd7cdd82 100644 --- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java +++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java @@ -48,6 +48,7 @@ import org.apache.coyote.http2.Http2Parser.Input; import org.apache.coyote.http2.Http2Parser.Output; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; +import org.apache.tomcat.util.ExceptionUtils; import org.apache.tomcat.util.http.MimeHeaders; import org.apache.tomcat.util.http.parser.Priority; import org.apache.tomcat.util.log.UserDataHelper; @@ -441,6 +442,13 @@ class Http2UpgradeHandler extends AbstractStream implements InternalHttpUpgradeH log.debug(sm.getString("upgradeHandler.ioerror", connectionId), ioe); } close(); + } catch (Throwable t) { + ExceptionUtils.handleThrowable(t); + if (log.isDebugEnabled()) { + log.debug(sm.getString("upgradeHandler.throwable", connectionId), t); + } + // Unexpected errors close the connection. + close(); } if (log.isTraceEnabled()) { diff --git a/java/org/apache/coyote/http2/LocalStrings.properties b/java/org/apache/coyote/http2/LocalStrings.properties index 482addf4e2..adbda69a2f 100644 --- a/java/org/apache/coyote/http2/LocalStrings.properties +++ b/java/org/apache/coyote/http2/LocalStrings.properties @@ -163,6 +163,7 @@ upgradeHandler.stream.error=Connection [{0}], Stream [{1}] Closed due to error upgradeHandler.stream.even=A new remote stream ID of [{0}] was requested but all remote streams must use odd identifiers upgradeHandler.stream.notWritable=Connection [{0}], Stream [{1}], This stream is in state [{2}] and is not writable upgradeHandler.stream.old=A new remote stream ID of [{0}] was requested but the most recent stream was [{1}] +upgradeHandler.throwable=Connection [{0}] upgradeHandler.tooManyRemoteStreams=The client attempted to use more than [{0}] active streams upgradeHandler.tooMuchOverhead=Connection [{0}], Too much overhead so the connection will be closed upgradeHandler.unexpectedAck=Connection [{0}], Stream [{1}], A settings acknowledgement was received when not expected diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 6ffbe84cda..ffd6d26fa5 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -188,6 +188,9 @@ <bug>69614</bug>: HTTP/2 priority frames with an invalid priority field value should be ignored. (markt) </fix> + <fix> + Improve handling of unexpected errors during HTTP/2 processing. (markt) + </fix> </changelog> </subsection> <subsection name="Jasper"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org