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/07/06 16:47:19 UTC

[httpcomponents-core] branch 4.4.x updated: HTTPCORE-634: fix possible race condition

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

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


The following commit(s) were added to refs/heads/4.4.x by this push:
     new c96c35c  HTTPCORE-634: fix possible race condition
c96c35c is described below

commit c96c35cd0c209d0589a2bf1b4bf3fdf6b0c05df3
Author: djelinski <30...@users.noreply.github.com>
AuthorDate: Mon Jul 6 13:37:38 2020 +0200

    HTTPCORE-634: fix possible race condition
    
    pool cached in getPoolEntryBlocking could be removed from routeToPool map by another thread while the thread executing getPoolEntryBlocking was waiting on condition.
    After this change we check routeToPool after every wait.
---
 httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java b/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
index e427720..7d8041d 100644
--- a/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
+++ b/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
@@ -318,13 +318,13 @@ public abstract class AbstractConnPool<T, C, E extends PoolEntry<T, C>>
         }
         this.lock.lock();
         try {
-            final RouteSpecificPool<T, C, E> pool = getPool(route);
             E entry;
             for (;;) {
                 Asserts.check(!this.isShutDown, "Connection pool shut down");
                 if (future.isCancelled()) {
                     throw new ExecutionException(operationAborted());
                 }
+                final RouteSpecificPool<T, C, E> pool = getPool(route);
                 for (;;) {
                     entry = pool.getFree(state);
                     if (entry == null) {