Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

HttpJettySolrClient: don't throw IllegalStateException if connection lost (#4490)

David Smiley60397085723d
diff --git a/changelog/unreleased/PR#4490-HttpJettySolrClient-IllegalStateException.yml b/changelog/unreleased/PR#4490-HttpJettySolrClient-IllegalStateException.yml
new file mode 100644
index 00000000000..cf5b8961c98
--- /dev/null
+++ b/changelog/unreleased/PR#4490-HttpJettySolrClient-IllegalStateException.yml
@@ -0,0 +1,9 @@
+title: >
+ HttpJettySolrClient could throw IllegalStateException on connection lost,
+ which foiled LBSolrClient's attempts to classify a request as retry-able.
+type: fixed
+authors:
+ - name: David Smiley
+links:
+ - name: PR#4490
+ url: https://github.com/apache/solr/pull/4490
diff --git a/solr/solrj-jetty/src/java/org/apache/solr/client/solrj/jetty/HttpJettySolrClient.java b/solr/solrj-jetty/src/java/org/apache/solr/client/solrj/jetty/HttpJettySolrClient.java
index fdd5fa8443b..46f0a23aec6 100644
--- a/solr/solrj-jetty/src/java/org/apache/solr/client/solrj/jetty/HttpJettySolrClient.java
+++ b/solr/solrj-jetty/src/java/org/apache/solr/client/solrj/jetty/HttpJettySolrClient.java
@@ -507,6 +507,10 @@ public class HttpJettySolrClient extends HttpSolrClient {
"IOException occurred when talking to server at: " + url, cause);
}
throw new SolrServerException(cause.getMessage(), cause);
+ } catch (IllegalStateException e) {
+ // Jetty HTTP/2 throws IllegalStateException ("session closed") when the connection is lost.
+ abortCause = e;
+ throw new SolrServerException("Connection lost at: " + url, new IOException(e));
} catch (SolrServerException | RuntimeException sse) {
abortCause = sse;
throw sse;