[ https://issues.apache.org/jira/browse/SOLR-9604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15548409#comment-15548409 ]
Alan Woodward commented on SOLR-9604: ------------------------------------- It's there in the patch: {code} diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java index b9580b8..0f738c2 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java @@ -198,7 +198,12 @@ public class HttpClientUtil { * configuration (no additional configuration) is created. */ public static CloseableHttpClient createClient(SolrParams params) { - return createClient(params, new PoolingHttpClientConnectionManager(schemaRegistryProvider.getSchemaRegistry())); + return createClient(params, createPoolingConnectionManager()); + } + + /** test usage subject to change @lucene.experimental */ + static PoolingHttpClientConnectionManager createPoolingConnectionManager() { + return new PoolingHttpClientConnectionManager(schemaRegistryProvider.getSchemaRegistry()); } public static CloseableHttpClient createClient(SolrParams params, PoolingHttpClientConnectionManager cm) { @@ -396,10 +401,17 @@ public class HttpClientUtil { } /** - * + * Create a HttpClientContext object + * + * If the client is going to be re-used, then you should pass in an object that + * can be used by internal connection pools as a cache key. This is particularly + * important if client authentication is enabled, as SSL connections will not + * be re-used if no cache key is provided. + * + * @param cacheKey an Object to be used as a cache key for pooling connections */ - public static HttpClientContext createNewHttpClientRequestContext() { - return httpClientRequestContextBuilder.createContext(); + public static HttpClientContext createNewHttpClientRequestContext(Object cacheKey) { + return httpClientRequestContextBuilder.createContext(cacheKey); } {code} > Pooled SSL connections are not being reused with client authentication > ---------------------------------------------------------------------- > > Key: SOLR-9604 > URL: https://issues.apache.org/jira/browse/SOLR-9604 > Project: Solr > Issue Type: Bug > Security Level: Public(Default Security Level. Issues are Public) > Reporter: Alan Woodward > Assignee: Alan Woodward > Attachments: SOLR-9604.patch > > > Solr isn't setting user tokens on any of its HttpClientContext objects when > requested new http connections. This means that when SSL + client > authentication is used, HttpClient is creating a new connection on every > request, to ensure that authentication tokens aren't shared between different > users. We end up with lots of unused open connections in the connection > pool, leading to slowness and out-of-memory errors. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org