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 2021/12/17 09:55:36 UTC
[httpcomponents-client] branch 5.1.x updated: Bug fix: Incorrect connection validity check in the async connection manager can cause an IllegalStateException and lead to a connection leak. Treat closed connections as valid due to the connection open check being inherently racy
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 f5ed2cd Bug fix: Incorrect connection validity check in the async connection manager can cause an IllegalStateException and lead to a connection leak. Treat closed connections as valid due to the connection open check being inherently racy
f5ed2cd is described below
commit f5ed2cd4693403560e81fd95e88cf92cd601190c
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Thu Dec 16 20:40:04 2021 +0100
Bug fix: Incorrect connection validity check in the async connection manager can cause an IllegalStateException and lead to a connection leak. Treat closed connections as valid due to the connection open check being inherently racy
---
.../client5/http/impl/nio/PoolingAsyncClientConnectionManager.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java
index b7c609f..32617d6 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java
@@ -79,7 +79,6 @@ import org.apache.hc.core5.pool.StrictConnPool;
import org.apache.hc.core5.reactor.Command;
import org.apache.hc.core5.reactor.ConnectionInitiator;
import org.apache.hc.core5.util.Args;
-import org.apache.hc.core5.util.Asserts;
import org.apache.hc.core5.util.Identifiable;
import org.apache.hc.core5.util.TimeValue;
import org.apache.hc.core5.util.Timeout;
@@ -545,8 +544,9 @@ public class PoolingAsyncClientConnectionManager implements AsyncClientConnectio
PoolEntry<HttpRoute, ManagedAsyncClientConnection> getValidatedPoolEntry() {
final PoolEntry<HttpRoute, ManagedAsyncClientConnection> poolEntry = getPoolEntry();
- final ManagedAsyncClientConnection connection = poolEntry.getConnection();
- Asserts.check(connection != null && connection.isOpen(), "Endpoint is not connected");
+ if (poolEntry.getConnection() == null) {
+ throw new ConnectionShutdownException();
+ }
return poolEntry;
}