You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by tf...@apache.org on 2022/10/03 23:08:19 UTC
[solr] branch branch_9x updated: SOLR-16229: Abort requests on exception (#1047)
This is an automated email from the ASF dual-hosted git repository.
tflobbe pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/branch_9x by this push:
new 0ad440cac08 SOLR-16229: Abort requests on exception (#1047)
0ad440cac08 is described below
commit 0ad440cac085d21d50bb3a0cccfb0b6dff49ffba
Author: Tomas Eduardo Fernandez Lobbe <tf...@apache.org>
AuthorDate: Mon Oct 3 14:29:12 2022 -0700
SOLR-16229: Abort requests on exception (#1047)
---
solr/CHANGES.txt | 4 +++-
.../org/apache/solr/client/solrj/impl/Http2SolrClient.java | 11 ++++++++++-
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 132dfb251ef..12cee9d1dfe 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -164,7 +164,7 @@ Bug Fixes
* SOLR-16417: NPE if facet query hits timeout or exception (Kevin Risden)
-* SOLR-16414 : Race condition in PRS state updates (noble, Justin Sweeney, Patson Luk, Hitesh Khamesra, Ishan Chattopadhyaya)
+* SOLR-16414: Race condition in PRS state updates (noble, Justin Sweeney, Patson Luk, Hitesh Khamesra, Ishan Chattopadhyaya)
* SOLR-16418: Introduce SolrResponseUtil to handle NPE during query timeout or exception when parsing SolrResponse (Kevin Risden)
@@ -174,6 +174,8 @@ Bug Fixes
* SOLR-16232: Fix EnvVar usage in bin/solr (Houston Putman)
+* SOLR-16229: Http2SolrClient aborts requests on exception (Daniel Rabus, Tomás Fernández Löbbe)
+
Other Changes
---------------------
* SOLR-16351: Upgrade Carrot2 to 4.4.3, upgrade randomizedtesting to 2.8.0. (Dawid Weiss)
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 d2cef8b7667..7f133600779 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
@@ -449,22 +449,24 @@ public class Http2SolrClient extends SolrClient {
final ResponseParser parser =
solrRequest.getResponseParser() == null ? this.parser : solrRequest.getResponseParser();
+ Throwable abortCause = null;
try {
InputStreamResponseListener listener = new InputStreamResponseListener();
req.send(listener);
Response response = listener.get(idleTimeout, TimeUnit.MILLISECONDS);
InputStream is = listener.getInputStream();
assert ObjectReleaseTracker.track(is);
-
return processErrorsAndResponse(solrRequest, parser, response, is);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
+ abortCause = e;
throw new RuntimeException(e);
} catch (TimeoutException e) {
throw new SolrServerException(
"Timeout occured while waiting response from server at: " + req.getURI(), e);
} catch (ExecutionException e) {
Throwable cause = e.getCause();
+ abortCause = cause;
if (cause instanceof ConnectException) {
throw new SolrServerException("Server refused connection at: " + req.getURI(), cause);
}
@@ -475,6 +477,13 @@ public class Http2SolrClient extends SolrClient {
"IOException occured when talking to server at: " + getBaseURL(), cause);
}
throw new SolrServerException(cause.getMessage(), cause);
+ } catch (SolrServerException | RuntimeException sse) {
+ abortCause = sse;
+ throw sse;
+ } finally {
+ if (abortCause != null) {
+ req.abort(abortCause);
+ }
}
}