diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 57d53823bfb..f7269482469 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -268,6 +268,8 @@ Bug Fixes * SOLR-14219: SOLR-14095 Introduced an issue for rolling restarts (Incompatible Java serialization). This change Fixes the compatibility issue while keeping the functionality in SOLR-14095. (Andy Webb, Tomás Fernández Löbbe) +* SOLR-13887: Use default idleTimeout instead of 0 for HTTP2 requests. (Houston Putman) + Other Changes --------------------- diff --git a/solr/solr-ref-guide/src/format-of-solr-xml.adoc b/solr/solr-ref-guide/src/format-of-solr-xml.adoc index 899da945d9e..0190203e640 100644 --- a/solr/solr-ref-guide/src/format-of-solr-xml.adoc +++ b/solr/solr-ref-guide/src/format-of-solr-xml.adoc @@ -40,8 +40,8 @@ You can find `solr.xml` in your `$SOLR_HOME` directory (usually `server/solr`) i - ${socketTimeout:0} - ${connTimeout:0} + ${socketTimeout:600000} + ${connTimeout:600000} @@ -232,15 +232,15 @@ Solr supports variable substitution of JVM system property values in `solr.xml`, Any JVM system properties usually specified using the `-D` flag when starting the JVM, can be used as variables in the `solr.xml` file. -For example, in the `solr.xml` file shown below, the `socketTimeout` and `connTimeout` values are each set to "0". However, if you start Solr using `bin/solr -DsocketTimeout=1000`, the `socketTimeout` option of the `HttpShardHandlerFactory` to be overridden using a value of 1000ms, while the `connTimeout` option will continue to use the default property value of "0". +For example, in the `solr.xml` file shown below, the `socketTimeout` and `connTimeout` values are each set to "60000". However, if you start Solr using `bin/solr -DsocketTimeout=1000`, the `socketTimeout` option of the `HttpShardHandlerFactory` to be overridden using a value of 1000ms, while the `connTimeout` option will continue to use the default property value of "60000". [source,xml] ---- - ${socketTimeout:0} - ${connTimeout:0} + ${socketTimeout:60000} + ${connTimeout:60000} ---- diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java index 8c6e546b14d..32eddc1a224 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java @@ -146,7 +146,7 @@ public class Http2SolrClient extends SolrClient { this.serverBaseUrl = serverBaseUrl; } - if (builder.idleTimeout != null) idleTimeout = builder.idleTimeout; + if (builder.idleTimeout != null && builder.idleTimeout > 0) idleTimeout = builder.idleTimeout; else idleTimeout = HttpClientUtil.DEFAULT_SO_TIMEOUT; if (builder.http2SolrClient == null) { @@ -215,7 +215,7 @@ public class Http2SolrClient extends SolrClient { httpClient.setMaxRequestsQueuedPerDestination(asyncTracker.getMaxRequestsQueuedPerDestination()); httpClient.setUserAgentField(new HttpField(HttpHeader.USER_AGENT, AGENT)); - if (builder.idleTimeout != null) httpClient.setIdleTimeout(builder.idleTimeout); + httpClient.setIdleTimeout(idleTimeout); if (builder.connectionTimeout != null) httpClient.setConnectTimeout(builder.connectionTimeout); try { httpClient.start(); diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/Http2SolrClientTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/Http2SolrClientTest.java index 06e4ba9efa0..6462f2c7dcb 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/Http2SolrClientTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/Http2SolrClientTest.java @@ -183,6 +183,17 @@ public class Http2SolrClientTest extends SolrJettyTestBase { } + @Test + public void test0IdleTimeout() throws Exception { + SolrQuery q = new SolrQuery("*:*"); + try(Http2SolrClient client = getHttp2SolrClient(jetty.getBaseUrl().toString() + "/debug/foo", DEFAULT_CONNECTION_TIMEOUT, 0)) { + try { + client.query(q, SolrRequest.METHOD.GET); + } catch (ParseException ignored) {} + } + + } + /** * test that SolrExceptions thrown by HttpSolrClient can * correctly encapsulate http status codes even when not on the list of