hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject [04/34] httpcomponents-core git commit: HTTPCORE-370: Race condition if connection request succeeds and times out at the same time
Date Tue, 09 May 2017 20:02:33 GMT
HTTPCORE-370: Race condition if connection request succeeds and times out at the same time

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.3.x@1558916
13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/24a0c3d1
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/24a0c3d1
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/24a0c3d1

Branch: refs/heads/4.3.x
Commit: 24a0c3d114219ecf40c0b8428ce7f5e096374ae4
Parents: 68a4258
Author: Oleg Kalnichevski <olegk@apache.org>
Authored: Thu Jan 16 20:54:23 2014 +0000
Committer: Oleg Kalnichevski <olegk@apache.org>
Committed: Thu Jan 16 20:54:23 2014 +0000

----------------------------------------------------------------------
 RELEASE_NOTES.txt                                            | 3 +++
 .../http/impl/nio/reactor/DefaultConnectingIOReactor.java    | 8 ++++++++
 2 files changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/24a0c3d1/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index ed3ead2..2525088 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -1,6 +1,9 @@
 Changes since release 4.3.1
 -------------------
 
+* [HTTPCORE-370] Race condition if connection request succeeds and times out at the same
time.  
+  Contributed by Oleg Kalnichevski <olegk at apache.org>
+
 * (Regression) Fixed synchronization issue in blocking and non-blocking connection pool 
   implementations caused by HTTPCORE-362
   Contributed by Oleg Kalnichevski <olegk at apache.org>

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/24a0c3d1/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultConnectingIOReactor.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultConnectingIOReactor.java
b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultConnectingIOReactor.java
index b4dfbb9..37fad64 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultConnectingIOReactor.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultConnectingIOReactor.java
@@ -177,11 +177,19 @@ public class DefaultConnectingIOReactor extends AbstractMultiworkerIOReactor
                 key.cancel();
                 if (channel.isConnected()) {
                     addChannel(new ChannelEntry(channel, sessionRequest));
+                    key.attach(null);
                 }
             }
 
         } catch (final CancelledKeyException ex) {
+            final SessionRequestHandle requestHandle = (SessionRequestHandle) key.attachment();
             key.attach(null);
+            if (requestHandle != null) {
+                final SessionRequestImpl sessionRequest = requestHandle.getSessionRequest();
+                if (sessionRequest != null) {
+                    sessionRequest.cancel();
+                }
+            }
         }
     }
 


Mime
View raw message