This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push: new a4ea8cc094 Fix h2 connection timeout issue with useAsyncIO=true a4ea8cc094 is described below commit a4ea8cc0946aafaadeb0ff44d8690887a04d6032 Author: Mark Thomas <ma...@apache.org> AuthorDate: Thu Feb 9 17:32:50 2023 +0000 Fix h2 connection timeout issue with useAsyncIO=true --- java/org/apache/coyote/AbstractProtocol.java | 3 ++ .../coyote/http2/TestHttp2ConnectionTimeouts.java | 40 ++++++++++++++++++++++ webapps/docs/changelog.xml | 5 +++ 3 files changed, 48 insertions(+) diff --git a/java/org/apache/coyote/AbstractProtocol.java b/java/org/apache/coyote/AbstractProtocol.java index 1304c67401..873a1f83ba 100644 --- a/java/org/apache/coyote/AbstractProtocol.java +++ b/java/org/apache/coyote/AbstractProtocol.java @@ -1016,6 +1016,9 @@ public abstract class AbstractProtocol<S> implements ProtocolHandler, MBeanRegis } else if (state == SocketState.ASYNC_IO) { // Don't add sockets back to the poller. // The handler will initiate all further I/O + if (status != SocketEvent.OPEN_WRITE) { + getProtocol().addWaitingProcessor(processor); + } } else if (state == SocketState.SUSPENDED) { // Don't add sockets back to the poller. // The resumeProcessing() method will add this socket diff --git a/test/org/apache/coyote/http2/TestHttp2ConnectionTimeouts.java b/test/org/apache/coyote/http2/TestHttp2ConnectionTimeouts.java new file mode 100644 index 0000000000..5f1970daaf --- /dev/null +++ b/test/org/apache/coyote/http2/TestHttp2ConnectionTimeouts.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.coyote.http2; + +import org.junit.Assert; +import org.junit.Test; + +public class TestHttp2ConnectionTimeouts extends Http2TestBase { + + @Test + public void testConnectionTimeout() throws Exception { + + // Reduce default timeouts so test completes sooner + enableHttp2(200, false, 5000, 5000, 10000, 5000, 5000); + configureAndStartWebApplication(); + openClientConnection(false); + doHttpUpgrade(); + sendClientPreface(); + validateHttp2InitialResponse(); + + // Wait for timeout - should receive GoAway frame + parser.readFrame(); + + Assert.assertEquals("0-Goaway-[1]-[0]-[null]", output.getTrace()); + } +} diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 4152b2575d..1393f0b748 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -140,6 +140,11 @@ <code>WINDOW_UPDATE</code> frame on an HTTP/2 connection where the flow control window for the overall connection has been exhausted. (markt) </fix> + <fix> + Fix a regression introduced in 9.0.65 that prevented HTTP/2 connections + from timing out when using a Connector configured with + <code>useAsyncIO=true</code> (the default for NIO and NIO2). (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