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 2022/08/17 16:44:17 UTC

[httpcomponents-client] branch 5.1.x updated: HTTPCLIENT-2231: a race condition in the main async exec when the request execution on an I/O thread is faster then execution pipeline management on the client thread

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

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


The following commit(s) were added to refs/heads/5.1.x by this push:
     new 6eb2cfcd8 HTTPCLIENT-2231: a race condition in the main async exec when the request execution on an I/O thread is faster then execution pipeline management on the client thread
6eb2cfcd8 is described below

commit 6eb2cfcd8140198a1b369e8073670f06ded7477f
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Wed Aug 17 18:39:05 2022 +0200

    HTTPCLIENT-2231: a race condition in the main async exec when the request execution on an I/O thread is faster then execution pipeline management on the client thread
---
 .../apache/hc/client5/http/impl/async/HttpAsyncMainClientExec.java    | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncMainClientExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncMainClientExec.java
index 23eb2b95c..e44a3a0f8 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncMainClientExec.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncMainClientExec.java
@@ -126,7 +126,9 @@ class HttpAsyncMainClientExec implements AsyncExecChainHandler {
 
             @Override
             public void cancel() {
-                failed(new InterruptedIOException());
+                if (messageCountDown.get() > 0) {
+                    failed(new InterruptedIOException());
+                }
             }
 
             @Override