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 2019/06/04 16:22:34 UTC

[tomcat] branch 8.5.x updated: Clear waitFor earlier. Avoid multiple stream.notify() calls and timeouts

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
     new 1174ecc  Clear waitFor earlier. Avoid multiple stream.notify() calls and timeouts
1174ecc is described below

commit 1174ecc8c8ac41e7888ae3ab0e7f133ddac07d9c
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Jun 4 17:21:18 2019 +0100

    Clear waitFor earlier. Avoid multiple stream.notify() calls and timeouts
---
 java/org/apache/coyote/http2/WindowAllocationManager.java | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/coyote/http2/WindowAllocationManager.java b/java/org/apache/coyote/http2/WindowAllocationManager.java
index 56acab9..da7aebe 100644
--- a/java/org/apache/coyote/http2/WindowAllocationManager.java
+++ b/java/org/apache/coyote/http2/WindowAllocationManager.java
@@ -133,8 +133,6 @@ class WindowAllocationManager {
             } else {
                 stream.wait(timeout);
             }
-
-            waitingFor = NONE;
         }
     }
 
@@ -163,6 +161,12 @@ class WindowAllocationManager {
 
         synchronized (stream) {
             if ((notifyTarget & waitingFor) > NONE) {
+                // Reset this here so multiple notifies (possible with a
+                // backlog containing multiple streams and small window updates)
+                // are handled correctly (only the first should trigger a call
+                // to stream.notify(). Additional notify() calls may trigger
+                // unexpected timeouts.
+                waitingFor = NONE;
                 if (stream.getCoyoteResponse().getWriteListener() == null) {
                     // Blocking, so use notify to release StreamOutputBuffer
                     if (log.isDebugEnabled()) {
@@ -171,7 +175,6 @@ class WindowAllocationManager {
                     }
                     stream.notify();
                 } else {
-                    waitingFor = NONE;
                     // Non-blocking so dispatch
                     if (log.isDebugEnabled()) {
                         log.debug(sm.getString("windowAllocationManager.dispatched",


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