You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2022/12/19 14:52:49 UTC

[tomcat] branch main updated: Fix BZ 66382 - read timeout bug with HTTP/2 and NIO2

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 2f5bdbad13 Fix BZ 66382 - read timeout bug with HTTP/2 and NIO2
2f5bdbad13 is described below

commit 2f5bdbad1343cfad6b4ae51b682266ae6068cbaa
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Dec 19 14:52:34 2022 +0000

    Fix BZ 66382 - read timeout bug with HTTP/2 and NIO2
    
    https://bz.apache.org/bugzilla/show_bug.cgi?id=66385
---
 java/org/apache/coyote/http2/Http2AsyncParser.java | 6 ++++--
 webapps/docs/changelog.xml                         | 5 +++++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/coyote/http2/Http2AsyncParser.java b/java/org/apache/coyote/http2/Http2AsyncParser.java
index d01497051d..a2043557b7 100644
--- a/java/org/apache/coyote/http2/Http2AsyncParser.java
+++ b/java/org/apache/coyote/http2/Http2AsyncParser.java
@@ -134,8 +134,10 @@ class Http2AsyncParser extends Http2Parser {
         ByteBuffer header = ByteBuffer.allocate(9);
         ByteBuffer framePayload = ByteBuffer.allocate(input.getMaxFrameSize());
         FrameCompletionHandler handler = new FrameCompletionHandler(expected, header, framePayload);
-        CompletionState state =
-                socketWrapper.read(block ? BlockingMode.BLOCK : BlockingMode.NON_BLOCK, socketWrapper.getReadTimeout(), TimeUnit.MILLISECONDS, null, handler, handler, header, framePayload);
+        CompletionState state = socketWrapper.read(
+                block ? BlockingMode.BLOCK : BlockingMode.NON_BLOCK,
+                block ? socketWrapper.getReadTimeout() : 0,
+                TimeUnit.MILLISECONDS, null, handler, handler, header, framePayload);
         if (state == CompletionState.ERROR || state == CompletionState.INLINE) {
             handleAsyncException();
             return true;
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index f7685e8a37..189b68b020 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -142,6 +142,11 @@
         code <code>NO_ERROR</code> so that client does not discard the response.
         Based on a suggestion by Lorenzo Dalla Vecchia. (markt)
       </fix>
+      <fix>
+        <bug>66385</bug>: Correct a bug in HTTP/2 where a non-blocking read for
+        a new frame with the NIO2 connector was incorrectly made using the read
+        timeout leading to unexpected stream closure. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Other">


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org