dsmiley commented on code in PR #4714:
URL: https://github.com/apache/solr/pull/4714#discussion_r3729098764


##########
solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java:
##########
@@ -206,9 +207,34 @@ public ClusterState getClusterState() {
     return getClusterStateProvider().getClusterState();
   }
 
+  /**
+   * Matches the message of the {@link IOException} the Jetty HTTP/2 client 
produces when a stream
+   * or session fails without an HTTP response, e.g. {@code 
cancel_stream_error/input_shutdown} when
+   * the server shuts down while a request is in flight. All HTTP/2 error code 
names end in {@code
+   * _error} (see RFC 9113 section 7).
+   */
+  private static final Pattern HTTP2_STREAM_FAILURE_MESSAGE =
+      Pattern.compile("[a-z0-9_]+_error/.*");
+
   /** Is this a communication error? We will retry if so. */
   protected boolean wasCommError(Throwable t) {
-    return t instanceof SocketException || t instanceof UnknownHostException;
+    return t instanceof SocketException
+        || t instanceof UnknownHostException
+        || wasHttp2StreamFailure(t);
+  }
+
+  /**
+   * HTTP/2 stream and session failures, such as the server closing the 
connection while a request
+   * is in flight, surface from the Jetty client as a plain {@link 
IOException} carrying only a
+   * message. No HTTP response was received, so treat them as communication 
errors, just like a
+   * {@link SocketException}.
+   */
+  private static boolean wasHttp2StreamFailure(Throwable t) {
+    if (t == null || t.getClass() != IOException.class) {

Review Comment:
   let's assume/guarantee the argument isn't null; it's unreasonable to call 
this with null.  I don't like excessive null checks.  I hope for us to embrace 
JSpecify & NullAway soon.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to