[ https://issues.apache.org/jira/browse/SOLR-6245?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Patanachai Tangchaisin updated SOLR-6245: ----------------------------------------- Description: I spent time debugging our HttpSolrServer and HttpClient. We construct our HttpClient (we have some requirement regarding about connectionTimeout, soTimeout, etc.) and then pass it to HttpSolrServer. I found about that all our socket level and connection level configuration are ignored when creating a http connection. The problem is in HttpClient 4.3.X, they allows overriding of these parameters per request i.e. one request can have socketTimeout=100ms and another request can have socketTimeout=200ms. The logic to check whether to make it per-request base config or not depending on whether any of these parameters is set. In HttpSolrServer.java {code} protected NamedList<Object> executeMethod(HttpRequestBase method, final ResponseParser processor) throws SolrServerException { // XXX client already has this set, is this needed? method.getParams().setParameter(ClientPNames.HANDLE_REDIRECTS, followRedirects); method.addHeader("User-Agent", AGENT); {code} Only one parameter (HANDLE_REDIRECTS) is set but that trigger the logic[1] in HttpClient to initialize a default per-request base config, which eventually override any socket and connection configuration, we did via HttpClientBuilder. To conclude, a solution would be to remove this line {code} // XXX client already has this set, is this needed? method.getParams().setParameter(ClientPNames.HANDLE_REDIRECTS, {code} [1] - http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/InternalHttpClient.java?revision=1603745&view=markup [LINE:172] was: I spent time debugging our HttpSolrServer and HttpClient. We construct our HttpClient (we have some requirement regarding about connectionTimeout, soTimeout, etc.) and then pass it to HttpSolrServer. I found about that all our socket level and connection level configuration are ignored when creating a http connection. The problem is in HttpClient 4.3.X, they allows overriding of these parameters per request i.e. one request can have socketTimeout=100ms and another request can have socketTimeout=200ms. The logic to check whether to make it per-request base config or not depending on whether any of these parameters is set. In HttpSolrServer.java {code} protected NamedList<Object> executeMethod(HttpRequestBase method, final ResponseParser processor) throws SolrServerException { // XXX client already has this set, is this needed? method.getParams().setParameter(ClientPNames.HANDLE_REDIRECTS, followRedirects); method.addHeader("User-Agent", AGENT); {code} Only one parameter (HANDLE_REDIRECTS) is set but that trigger the logic^1^ in HttpClient to initialize a default per-request base config, which eventually override any socket and connection configuration, we did via HttpClientBuilder. To conclude, a solution would be to remove this line {code} // XXX client already has this set, is this needed? method.getParams().setParameter(ClientPNames.HANDLE_REDIRECTS, {code} [1] - http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/InternalHttpClient.java?revision=1603745&view=markup [LINE:172] > Socket and Connection configuration are ignored in HttpSolrServer when > passing in HttpClient > -------------------------------------------------------------------------------------------- > > Key: SOLR-6245 > URL: https://issues.apache.org/jira/browse/SOLR-6245 > Project: Solr > Issue Type: Bug > Components: clients - java > Reporter: Patanachai Tangchaisin > > I spent time debugging our HttpSolrServer and HttpClient. We construct our > HttpClient (we have some requirement regarding about connectionTimeout, > soTimeout, etc.) and then pass it to HttpSolrServer. I found about that all > our socket level and connection level configuration are ignored when creating > a http connection. > The problem is in HttpClient 4.3.X, they allows overriding of these > parameters per request i.e. one request can have socketTimeout=100ms and > another request can have socketTimeout=200ms. The logic to check whether to > make it per-request base config or not depending on whether any of these > parameters is set. In HttpSolrServer.java > {code} > protected NamedList<Object> executeMethod(HttpRequestBase method, final > ResponseParser processor) throws SolrServerException { > // XXX client already has this set, is this needed? > method.getParams().setParameter(ClientPNames.HANDLE_REDIRECTS, > followRedirects); > method.addHeader("User-Agent", AGENT); > {code} > Only one parameter (HANDLE_REDIRECTS) is set but that trigger the logic[1] in > HttpClient to initialize a default per-request base config, which eventually > override any socket and connection configuration, we did via > HttpClientBuilder. > To conclude, a solution would be to remove this line > {code} > // XXX client already has this set, is this needed? > method.getParams().setParameter(ClientPNames.HANDLE_REDIRECTS, > {code} > [1] - > http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/InternalHttpClient.java?revision=1603745&view=markup > [LINE:172] -- This message was sent by Atlassian JIRA (v6.2#6252) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org