-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 All,
Our single-instance Solr server is just getting its first taste of production load, and I'm seeing this periodically: java.lang.IllegalStateException: Connection is still allocated The stack trace shows it's coming from HTTP Client as called from within Solr. We are using SolrJ 7.2.1 and Solr (server) 7.4.0. Our code looks something like this: private HashMap<String,HttpSolrClient> CLIENT_REGISTRY = new HashMap<String,HttpSolrClient>(); synchronized HttpSolrClient getSolrClient(String url) throws ServiceException, SolrServerException, IOException, GeneralSecurityException { HttpSolrClient solrClient = CLIENT_REGISTRY.get(url); if(null == solrClient) { log.info("Creating new HttpSolrClient connected to " + url); solrClient = new HttpSolrClient.Builder(url) .withHttpClient(getHttpClient()) .build(); solrClient.ping(); CLIENT_REGISTRY.put(url, solrClient); } return solrClient; } [here's the code that uses the above] SolrClient solr = getSolrRegistry().getSolrClient(url); SolrInputDocument doc = new SolrInputDocument(); // Add stuff to the document solr.add(doc); solr.commit(); That's it. Other than not really needing the "commit" at the end, is there anything wrong with how we are using SolrJ client? Are instances of SolrJClient not thread-safe? My assumption was that they were threadsafe and that HTTP Client would manage the connection pool under the covers. Here is the full stack trace: com.chadis.api.business.RegistrationProcessor- Error processing registration request java.lang.IllegalStateException: Connection is still allocated at org.apache.http.util.Asserts.check(Asserts.java:34) at org.apache.http.impl.conn.BasicHttpClientConnectionManager.getConnection (BasicHttpClientConnectionManager.java:251) at org.apache.http.impl.conn.BasicHttpClientConnectionManager$1.get(BasicHt tpClientConnectionManager.java:202) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.jav a:191) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:18 5) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:11 1) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpCli ent.java:185) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpCli ent.java:83) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpCli ent.java:56) at org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrC lient.java:542) at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient. java:255) at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient. java:244) at org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:194) at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:173) at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:138) at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:152) at [my code, calling SolrClient.add()] Any ideas? Thanks, - -chris -----BEGIN PGP SIGNATURE----- Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/ iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAluhFVQACgkQHPApP6U8 pFhGeRAAgrg2GAmwhS9J/RBQC19SnebhevncmgMAF6nHhKegnXr8uv2fGvvySg53 BHCW0N3dtt9ZhI1VB7C9aBO65o/esW5rHi3/sIiY5QRfNIl39ajL8y98RWHJQEeA mhjoqNdqW/GopA3YaiCmf1YJZ0FsZV7iK04KboD5DRwhsqoa8XVDa44RYfdU4iDP cleMkQYY2KDSID0gJ2pf/Qj1acwR/hI2Q9+6kxc11/bXKCrWYAmLawV+DH6ZHqLF HT/7bNNJ+zV0df0WEKzUDQ9wVzTKXkzvYP7ueINIiomyZN7Pv+pF58BaAiICdlUr aqQMulLcKRC7qmN/5XqBZG00hkbH82n80o5foveTlQlC9yltSTbXjwFqd+FfOH8Y kBU+mHWkrZr/Ic29LkgLLzX1tG+QoXAgoEAASHOockaTX5oj2vsyFYQ5nVddOMNj /w1AgdpNztP5DLr1HQ6JhA+3nLZX43GaDxs/nENIOI2Xe36kXfS/so9Cv7DaAjQ8 OkGdOLUksQaukFZ/3MUwbgan5tQYYp4zSmky4RGS7Nd0ePTgvk4pH1uD4NFJnHWK fsSydLT43tiOWltQkzzby6QcpSg9WrV+0zsnEPQSQHH+ubDbFt03aXS1/tjYAZTF r8ttwGFfMQLa58hfWwBKMWtyM8m6n9gVMivhp5oENa3uFdo76kQ= =+WJu -----END PGP SIGNATURE-----