Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-8223: Avoid accidentally swallowing OutOfMemoryError (in LeaderInitiatedRecoveryThread.java or CoreContainer.java)

Christine Poerschkec2095b44fead
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 9a71bd499a2..261ca5b8a9d 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -330,6 +330,9 @@ Bug Fixes
* SOLR-7989: After a new leader is elected it should change it's state to ACTIVE even
if the last published state is something else (Ishan Chattopadhyaya, Mark Miller via noble )
+* SOLR-8223: Avoid accidentally swallowing OutOfMemoryError (in LeaderInitiatedRecoveryThread.java
+ or CoreContainer.java) (Mike Drob via Christine Poerschke)
+
Optimizations
----------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/LeaderInitiatedRecoveryThread.java b/solr/core/src/java/org/apache/solr/cloud/LeaderInitiatedRecoveryThread.java
index 1321adb6d0b..e9751d2b942 100644
--- a/solr/core/src/java/org/apache/solr/cloud/LeaderInitiatedRecoveryThread.java
+++ b/solr/core/src/java/org/apache/solr/cloud/LeaderInitiatedRecoveryThread.java
@@ -211,7 +211,7 @@ public class LeaderInitiatedRecoveryThread extends Thread {
" command to core={} coreNodeName={} on " + recoveryUrl, coreNeedingRecovery, replicaCoreNodeName);
continueTrying = false; // succeeded, so stop looping
- } catch (Throwable t) {
+ } catch (Exception t) {
Throwable rootCause = SolrException.getRootCause(t);
boolean wasCommError =
(rootCause instanceof ConnectException ||
diff --git a/solr/core/src/java/org/apache/solr/core/CoreContainer.java b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
index 3a80bd8a671..9d20e1ed6a8 100644
--- a/solr/core/src/java/org/apache/solr/core/CoreContainer.java
+++ b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
@@ -454,8 +454,8 @@ public class CoreContainer {
}
try {
zkSys.registerInZk(core, true);
- } catch (Throwable t) {
- SolrException.log(log, "Error registering SolrCore", t);
+ } catch (RuntimeException e) {
+ SolrException.log(log, "Error registering SolrCore", e);
}
return core;
}