On 2/3/2012 1:12 PM, Shawn Heisey wrote:
Is the following a reasonable approach to setting a connection timeout with SolrJ?

        queryCore.getHttpClient().getHttpConnectionManager().getParams()
                .setConnectionTimeout(15000);

Right now I have all my solr server objects sharing a single HttpClient that gets created using the multithreaded connection manager, where I set the timeout for all of them. Now I will be letting each server object create its own HttpClient object, and using the above statement to set the timeout on each one individually. It'll use up a bunch more memory, as there are 56 server objects, but maybe it'll work better. The total of 56 objects comes about from 7 shards, a build core and a live core per shard, two complete index chains, and for each of those, one server object for access to CoreAdmin and another for the index.

The impetus for this, as it's possible I'm stating an XY problem: Currently I have an occasional problem where SolrJ connections throw an exception. When it happens, nothing is logged in Solr. My code is smart enough to notice the problem, send an email alert, and simply try again at the top of the next minute. The simple explanation is that this is a Linux networking problem, but I never had any problem like this when I was using Perl with LWP to keep my index up to date. I sent a message to the list some time ago on this exception, but I never got a response that helped me figure it out.

Caused by: org.apache.solr.client.solrj.SolrServerException: java.net.SocketException: Connection reset

at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:480)

at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:246)

at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:89)

at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:276)

at com.newscom.idxbuild.solr.Core.getCount(Core.java:325)

... 3 more

Caused by: java.net.SocketException: Connection reset

at java.net.SocketInputStream.read(SocketInputStream.java:168)

at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)

at java.io.BufferedInputStream.read(BufferedInputStream.java:237)

at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:78)

at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:106)

at org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1116)

at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.readLine(MultiThreadedHttpConnectionManager.java:1413)

at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1973)

at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1735)

at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1098)

at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)

at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)

at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)

at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)

at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:424)

... 7 more

No response in quite some time, so I'm bringing it up again. I brought up the Exception issue before, and though I did get some responses, I didn't feel that I got an answer.

http://mail-archives.apache.org/mod_mbox/lucene-solr-user/201112.mbox/%3c4eeaf6e5.9030...@elyograg.org%3E

Thanks,
Shawn

Reply via email to