You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2020/09/28 12:32:25 UTC

[httpcomponents-core] branch 5.0.x updated: Calculate pendingOutputRequests before calling produceOutput to avoid race condition

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

olegk pushed a commit to branch 5.0.x
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git


The following commit(s) were added to refs/heads/5.0.x by this push:
     new 1dd57a3  Calculate pendingOutputRequests before calling produceOutput to avoid race condition
1dd57a3 is described below

commit 1dd57a3521abbbaa186ac16de2908aeb838b3412
Author: ColinWeld <c_...@backblaze.com>
AuthorDate: Thu Sep 24 17:25:16 2020 -0700

    Calculate pendingOutputRequests before calling produceOutput to avoid race condition
---
 .../org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java
index 1fcfe5e..d8b27d6 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java
@@ -346,8 +346,8 @@ abstract class AbstractHttp1StreamDuplexer<IncomingMessage extends HttpMessage,
             ioSession.getLock().unlock();
         }
         if (connState.compareTo(ConnectionState.SHUTDOWN) < 0) {
-            produceOutput();
             final int pendingOutputRequests = outputRequests.get();
+            produceOutput();
             final boolean outputPending = isOutputReady();
             final boolean outputEnd;
             ioSession.getLock().lock();