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 9d28ac5  Ensure flush(boolean) returns true when data remains to be 
written
9d28ac5 is described below

commit 9d28ac5240b896110d3d3b7d66bf1fc5a37ca1e0
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 cc76200..a25edfe 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -868,7 +868,9 @@ public 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 9c9c838..ebaedc5 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -96,6 +96,11 @@
         Add support for same-site cookie attribute. Patch provided by John
         Kelly. (markt)
       </add>
+      <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