This is an automated email from the ASF dual-hosted git repository.
houston 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 cf315a39f87 Catch cancellation exceptions - Fix TestTolerantSearch
(#3393)
cf315a39f87 is described below
commit cf315a39f87c46cfa31adba5dd49be7622e4b596
Author: Houston Putman <[email protected]>
AuthorDate: Wed Jun 25 16:45:26 2025 -0500
Catch cancellation exceptions - Fix TestTolerantSearch (#3393)
Co-authored-by: David Smiley <[email protected]>
(cherry picked from commit 1490cf820233243a57d2581eb660a8776968b6c3)
---
.../org/apache/solr/client/solrj/impl/Http2SolrClient.java | 10 ++++++++--
.../src/java/org/apache/solr/common/util/ExecutorUtil.java | 2 ++
2 files changed, 10 insertions(+), 2 deletions(-)
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 6cc4e62a5da..fcf8705400f 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
@@ -32,6 +32,7 @@ import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
+import java.util.concurrent.CancellationException;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
@@ -49,7 +50,6 @@ import org.apache.solr.client.solrj.SolrResponse;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.V2RequestSupport;
import org.apache.solr.client.solrj.embedded.SSLConfig;
-import
org.apache.solr.client.solrj.impl.BaseHttpSolrClient.RemoteSolrException;
import
org.apache.solr.client.solrj.impl.HttpListenerFactory.RequestResponseListener;
import org.apache.solr.client.solrj.request.RequestWriter;
import org.apache.solr.client.solrj.request.UpdateRequest;
@@ -543,7 +543,13 @@ public class Http2SolrClient extends HttpSolrClientBase {
mdcCopyHelper.onBegin(null);
log.debug("response processing success");
future.complete(body);
- } catch (RemoteSolrException | SolrServerException e) {
+ } catch (CancellationException e) {
+ mdcCopyHelper.onBegin(null);
+ log.debug("response processing cancelled", e);
+ if (!future.isDone()) {
+ future.cancel(true);
+ }
+ } catch (Throwable e) {
mdcCopyHelper.onBegin(null);
log.debug("response processing failed", e);
future.completeExceptionally(e);
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java
b/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java
index 129ec8df8ca..e6e1cd44941 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java
@@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Callable;
+import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
@@ -378,6 +379,7 @@ public class ExecutorUtil {
}
try {
command.run();
+ } catch (CancellationException ignored) {
} catch (Throwable t) {
if (t instanceof OutOfMemoryError) {
throw t;