You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by Ufuk YILMAZ <uy...@vivaldi.net.INVALID> on 2025/09/02 03:19:38 UTC

Http2SolrClient - possible stale connection issue?

I'm using Http2SolrClient to send search requests to Solr from my 
Java/Spring application. The searches originate from a search box on the 
website, and everything works fine when the app first starts or when 
searches are made continuously. However, if I stop making searches and 
leave the website idle for a while, exceptions occur on the next search 
sent to Solr, even though there are no connectivity issues between Solr 
and my app. I suspect this might be due to a stale connection issue, 
where the client attempts to use a connection that has already been 
closed on the Solr side(?). Here is the code snippet where my client is 
built, with timeouts set to 30 seconds:

----
   @Bean
   public Http2SolrClient solrClient(SolrConfiguration solrConfiguration) 
{
     int timeout = solrConfiguration.getTimeout();
     Http2SolrClient solrClient =
         new Http2SolrClient.Builder(solrConfiguration.getBaseUrl())
             .withConnectionTimeout(timeout, TimeUnit.SECONDS)
             .withIdleTimeout(timeout, TimeUnit.SECONDS)
             .withRequestTimeout(timeout, TimeUnit.SECONDS)
             .build();
     return solrClient;
   }
----

I looked for something similar to "validateafterinactivity" method of 
Apache HTPP Client's connection pool, but I couldn't find something 
similar to that.

Any ideas?


-Ufuk