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 2014/07/14 12:01:31 UTC

svn commit: r1610376 - in /httpcomponents/httpasyncclient/branches/4.0.x: RELEASE_NOTES.txt httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultClientExchangeHandlerImpl.java

Author: olegk
Date: Mon Jul 14 10:01:31 2014
New Revision: 1610376

URL: http://svn.apache.org/r1610376
Log:
HTTPASYNC-79: Rearranged sequence of operations upon connection lease to eliminate possibility of a connection leak due to race condition on keep-alive boundary

Modified:
    httpcomponents/httpasyncclient/branches/4.0.x/RELEASE_NOTES.txt
    httpcomponents/httpasyncclient/branches/4.0.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultClientExchangeHandlerImpl.java

Modified: httpcomponents/httpasyncclient/branches/4.0.x/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/branches/4.0.x/RELEASE_NOTES.txt?rev=1610376&r1=1610375&r2=1610376&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/branches/4.0.x/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpasyncclient/branches/4.0.x/RELEASE_NOTES.txt Mon Jul 14 10:01:31 2014
@@ -1,6 +1,10 @@
 Changes since 4.0.1
 -------------------
 
+* [HTTPASYNC-79] Rearranged sequence of operations upon connection lease to eliminate possibility
+  of a connection leak due to race condition on keep-alive boundary
+  Contributed by Oleg Kalnichevski <olegk at apache.org>
+
 * Replaced dynamic proxies with custom proxy classes to reduce thread contention.
   Contributed by Oleg Kalnichevski <olegk at apache.org>
 

Modified: httpcomponents/httpasyncclient/branches/4.0.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultClientExchangeHandlerImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/branches/4.0.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultClientExchangeHandlerImpl.java?rev=1610376&r1=1610375&r2=1610376&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/branches/4.0.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultClientExchangeHandlerImpl.java (original)
+++ httpcomponents/httpasyncclient/branches/4.0.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultClientExchangeHandlerImpl.java Mon Jul 14 10:01:31 2014
@@ -299,11 +299,10 @@ class DefaultClientExchangeHandlerImpl<T
                 return;
             }
 
+            managedConn.getContext().setAttribute(HttpAsyncRequestExecutor.HTTP_HANDLER, this);
+            managedConn.requestOutput();
             if (!managedConn.isOpen()) {
                 failed(new ConnectionClosedException("Connection closed"));
-            } else {
-                managedConn.getContext().setAttribute(HttpAsyncRequestExecutor.HTTP_HANDLER, this);
-                managedConn.requestOutput();
             }
         } catch (final RuntimeException runex) {
             failed(runex);