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

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


The following commit(s) were added to refs/heads/master by this push:
     new 092a899  Ensure flush(boolean) returns true when data remains to be 
written
092a899 is described below

commit 092a8995d94f2b56441d7446d93e91ee137ba3cf
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Jun 4 14:36:58 2019 +0100

    Ensure flush(boolean) returns true when data remains to be written
    
    Incorrectly returning false will lead to a further write which in some
    circumstances could lead to threads attempting to write concurrently.
---
 java/org/apache/coyote/http2/Stream.java | 4 +++-
 webapps/docs/changelog.xml               | 5 +++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/coyote/http2/Stream.java 
b/java/org/apache/coyote/http2/Stream.java
index b70c227..3de2b9f 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -887,7 +887,9 @@ class Stream extends AbstractStream implements 
HeaderEmitter {
                 flushed = true;
             }
 
-            if (!dataInBuffer) {
+            if (dataInBuffer) {
+                dataLeft = true;
+            } else {
                 if (writeBuffer.isEmpty()) {
                     // Both buffer and writeBuffer are empty.
                     if (flushed) {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 7701241..7154236 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -175,6 +175,11 @@
       <fix>
         Fix HTTP/2 end of stream concurrency with async. (remm)
       </fix>
+      <fix>
+        Correct a bug in the stream flushing code that could lead to multiple
+        threads processing the stream concurrently which in turn could cause
+        errors processing the stream. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Cluster">


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

Reply via email to