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 5588a2d Fix BZ 65460 5588a2d is described below commit 5588a2deb97189cccb29edcaab223f17715cbd73 Author: Mark Thomas <ma...@apache.org> AuthorDate: Fri Jul 23 14:28:38 2021 +0100 Fix BZ 65460 https://bz.apache.org/bugzilla/show_bug.cgi?id=65460 Correct a regression introduced in 10.1.0-M2, 10.0.8, 9.0.51 and 8.5.69 in the change to reduce the number of small HTTP/2 window updates sent for streams. A logic error meant that small window updates for the connection were dropped. This meant that the connection flow window slowly reduced over time until nothing could be sent. --- java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java | 5 ++++- java/org/apache/coyote/http2/Http2UpgradeHandler.java | 5 ++++- webapps/docs/changelog.xml | 7 +++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java b/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java index a79a7a8..cc85313 100644 --- a/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java +++ b/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java @@ -240,6 +240,7 @@ public class Http2AsyncUpgradeHandler extends Http2UpgradeHandler { ByteUtil.setThreeBytes(frame, 0, 4); frame[3] = FrameType.WINDOW_UPDATE.getIdByte(); ByteUtil.set31Bits(frame, 9, increment); + boolean neetToWriteConnectionUpdate = true; // No need to send update from closed stream if (stream instanceof Stream && ((Stream) stream).canWrite()) { int streamIncrement = ((Stream) stream).getWindowUpdateSizeToWrite(increment); @@ -256,8 +257,10 @@ public class Http2AsyncUpgradeHandler extends Http2UpgradeHandler { socketWrapper.write(BlockingMode.SEMI_BLOCK, protocol.getWriteTimeout(), TimeUnit.MILLISECONDS, null, SocketWrapperBase.COMPLETE_WRITE, errorCompletion, ByteBuffer.wrap(frame), ByteBuffer.wrap(frame2)); + neetToWriteConnectionUpdate = false; } - } else { + } + if (neetToWriteConnectionUpdate) { socketWrapper.write(BlockingMode.SEMI_BLOCK, protocol.getWriteTimeout(), TimeUnit.MILLISECONDS, null, SocketWrapperBase.COMPLETE_WRITE, errorCompletion, ByteBuffer.wrap(frame)); diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java b/java/org/apache/coyote/http2/Http2UpgradeHandler.java index add82e7..3b2a017 100644 --- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java +++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java @@ -823,6 +823,7 @@ class Http2UpgradeHandler extends AbstractStream implements InternalHttpUpgradeH frame[3] = FrameType.WINDOW_UPDATE.getIdByte(); ByteUtil.set31Bits(frame, 9, increment); socketWrapper.write(true, frame, 0, frame.length); + boolean needFlush = true; // No need to send update from closed stream if (stream instanceof Stream && ((Stream) stream).canWrite()) { int streamIncrement = ((Stream) stream).getWindowUpdateSizeToWrite(increment); @@ -837,6 +838,7 @@ class Http2UpgradeHandler extends AbstractStream implements InternalHttpUpgradeH try { socketWrapper.write(true, frame, 0, frame.length); socketWrapper.flush(true); + needFlush = false; } catch (IOException ioe) { if (applicationInitiated) { handleAppInitiatedIOException(ioe); @@ -845,7 +847,8 @@ class Http2UpgradeHandler extends AbstractStream implements InternalHttpUpgradeH } } } - } else { + } + if (needFlush) { socketWrapper.flush(true); } } diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 0bbed3b..096eaf6 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -152,6 +152,13 @@ request to finish processing rather than the thread pool creating a new thread to process the new request. (markt) </fix> + <fix> + <bug>65460</bug>: Correct a regression introduced in the previous + release in the change to reduce the number of small HTTP/2 window + updates sent for streams. A logic error meant that small window updates + for the connection were dropped. This meant that the connection flow + window slowly reduced over time until nothing could be sent. (markt) + </fix> </changelog> </subsection> <subsection name="Web applications"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org