This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push: new fac0d4e0d7 Fix h2 connection timeout issue with useAsyncIO=true fac0d4e0d7 is described below commit fac0d4e0d7c9b446f9d42f6d14f551772e6c2372 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 a322f61554..b4bf24edc3 100644 --- a/java/org/apache/coyote/AbstractProtocol.java +++ b/java/org/apache/coyote/AbstractProtocol.java @@ -984,6 +984,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 467919c2b3..1e2cd7b74e 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -153,6 +153,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 10.1.0-M17 that prevented HTTP/2 + connections from timing out when using a Connector configured with + <code>useAsyncIO=true</code> (the default). (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