mirror of https://github.com/apache/lucene.git
SOLR-4992: Solr eats OutOfMemoryError exceptions in many cases.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1557778 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e15b87b090
commit
cb23c8ba3c
|
@ -200,6 +200,9 @@ Bug Fixes
|
||||||
* SOLR-5567: ZkController getHostAddress duplicates url prefix.
|
* SOLR-5567: ZkController getHostAddress duplicates url prefix.
|
||||||
(Kyle Halliday, Alexey Serba, shalin)
|
(Kyle Halliday, Alexey Serba, shalin)
|
||||||
|
|
||||||
|
* SOLR-4992: Solr eats OutOfMemoryError exceptions in many cases.
|
||||||
|
(Mark Miller, Daniel Collins)
|
||||||
|
|
||||||
Optimizations
|
Optimizations
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
|
|
@ -224,7 +224,7 @@ public class LuceneCarrot2StemmerFactory implements IStemmerFactory {
|
||||||
public static IStemmer createStemmer() {
|
public static IStemmer createStemmer() {
|
||||||
try {
|
try {
|
||||||
return new LuceneStemmerAdapter();
|
return new LuceneStemmerAdapter();
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
return IdentityStemmer.INSTANCE;
|
return IdentityStemmer.INSTANCE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,6 +82,9 @@ public class LuceneCarrot2TokenizerFactory implements ITokenizerFactory {
|
||||||
.warn("Could not instantiate Smart Chinese Analyzer, clustering quality "
|
.warn("Could not instantiate Smart Chinese Analyzer, clustering quality "
|
||||||
+ "of Chinese content may be degraded. For best quality clusters, "
|
+ "of Chinese content may be degraded. For best quality clusters, "
|
||||||
+ "make sure Lucene's Smart Chinese Analyzer JAR is in the classpath");
|
+ "make sure Lucene's Smart Chinese Analyzer JAR is in the classpath");
|
||||||
|
if (e instanceof Error) {
|
||||||
|
throw (Error) e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,6 +92,9 @@ public class LuceneCarrot2TokenizerFactory implements ITokenizerFactory {
|
||||||
try {
|
try {
|
||||||
return new ChineseTokenizer();
|
return new ChineseTokenizer();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
if (e instanceof OutOfMemoryError) {
|
||||||
|
throw (OutOfMemoryError) e;
|
||||||
|
}
|
||||||
return new ExtendedWhitespaceTokenizer();
|
return new ExtendedWhitespaceTokenizer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ public class DataImportHandler extends RequestHandlerBase implements
|
||||||
}
|
}
|
||||||
debugEnabled = StrUtils.parseBool((String)initArgs.get(ENABLE_DEBUG), true);
|
debugEnabled = StrUtils.parseBool((String)initArgs.get(ENABLE_DEBUG), true);
|
||||||
importer = new DataImporter(core, myName);
|
importer = new DataImporter(core, myName);
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
LOG.error( DataImporter.MSG.LOAD_EXP, e);
|
LOG.error( DataImporter.MSG.LOAD_EXP, e);
|
||||||
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, DataImporter.MSG.LOAD_EXP, e);
|
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, DataImporter.MSG.LOAD_EXP, e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -402,7 +402,7 @@ public class DataImporter {
|
||||||
public void doFullImport(SolrWriter writer, RequestInfo requestParams) {
|
public void doFullImport(SolrWriter writer, RequestInfo requestParams) {
|
||||||
LOG.info("Starting Full Import");
|
LOG.info("Starting Full Import");
|
||||||
setStatus(Status.RUNNING_FULL_DUMP);
|
setStatus(Status.RUNNING_FULL_DUMP);
|
||||||
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
DIHProperties dihPropWriter = createPropertyWriter();
|
DIHProperties dihPropWriter = createPropertyWriter();
|
||||||
setIndexStartTime(dihPropWriter.getCurrentTimestamp());
|
setIndexStartTime(dihPropWriter.getCurrentTimestamp());
|
||||||
|
@ -411,10 +411,14 @@ public class DataImporter {
|
||||||
docBuilder.execute();
|
docBuilder.execute();
|
||||||
if (!requestParams.isDebug())
|
if (!requestParams.isDebug())
|
||||||
cumulativeStatistics.add(docBuilder.importStatistics);
|
cumulativeStatistics.add(docBuilder.importStatistics);
|
||||||
} catch (Throwable t) {
|
success = true;
|
||||||
SolrException.log(LOG, "Full Import failed", t);
|
} catch (Exception e) {
|
||||||
docBuilder.rollback();
|
SolrException.log(LOG, "Full Import failed", e);
|
||||||
} finally {
|
} finally {
|
||||||
|
if (!success) {
|
||||||
|
docBuilder.rollback();
|
||||||
|
}
|
||||||
|
|
||||||
setStatus(Status.IDLE);
|
setStatus(Status.IDLE);
|
||||||
DocBuilder.INSTANCE.set(null);
|
DocBuilder.INSTANCE.set(null);
|
||||||
}
|
}
|
||||||
|
@ -431,7 +435,7 @@ public class DataImporter {
|
||||||
public void doDeltaImport(SolrWriter writer, RequestInfo requestParams) {
|
public void doDeltaImport(SolrWriter writer, RequestInfo requestParams) {
|
||||||
LOG.info("Starting Delta Import");
|
LOG.info("Starting Delta Import");
|
||||||
setStatus(Status.RUNNING_DELTA_DUMP);
|
setStatus(Status.RUNNING_DELTA_DUMP);
|
||||||
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
DIHProperties dihPropWriter = createPropertyWriter();
|
DIHProperties dihPropWriter = createPropertyWriter();
|
||||||
setIndexStartTime(dihPropWriter.getCurrentTimestamp());
|
setIndexStartTime(dihPropWriter.getCurrentTimestamp());
|
||||||
|
@ -440,10 +444,13 @@ public class DataImporter {
|
||||||
docBuilder.execute();
|
docBuilder.execute();
|
||||||
if (!requestParams.isDebug())
|
if (!requestParams.isDebug())
|
||||||
cumulativeStatistics.add(docBuilder.importStatistics);
|
cumulativeStatistics.add(docBuilder.importStatistics);
|
||||||
} catch (Throwable t) {
|
success = true;
|
||||||
LOG.error("Delta Import Failed", t);
|
} catch (Exception e) {
|
||||||
docBuilder.rollback();
|
LOG.error("Delta Import Failed", e);
|
||||||
} finally {
|
} finally {
|
||||||
|
if (!success) {
|
||||||
|
docBuilder.rollback();
|
||||||
|
}
|
||||||
setStatus(Status.IDLE);
|
setStatus(Status.IDLE);
|
||||||
DocBuilder.INSTANCE.set(null);
|
DocBuilder.INSTANCE.set(null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -538,7 +538,7 @@ public class DocBuilder {
|
||||||
throw e;
|
throw e;
|
||||||
} else
|
} else
|
||||||
throw e;
|
throw e;
|
||||||
} catch (Throwable t) {
|
} catch (Exception t) {
|
||||||
if (verboseDebug) {
|
if (verboseDebug) {
|
||||||
getDebugLogger().log(DIHLogLevels.ENTITY_EXCEPTION, epw.getEntity().getName(), t);
|
getDebugLogger().log(DIHLogLevels.ENTITY_EXCEPTION, epw.getEntity().getName(), t);
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,8 +105,8 @@ public class SolrWriter extends DIHWriterBase implements DIHWriter {
|
||||||
try {
|
try {
|
||||||
CommitUpdateCommand commit = new CommitUpdateCommand(req,optimize);
|
CommitUpdateCommand commit = new CommitUpdateCommand(req,optimize);
|
||||||
processor.processCommit(commit);
|
processor.processCommit(commit);
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
log.error("Exception while solr commit.", t);
|
log.error("Exception while solr commit.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,8 +115,8 @@ public class SolrWriter extends DIHWriterBase implements DIHWriter {
|
||||||
try {
|
try {
|
||||||
RollbackUpdateCommand rollback = new RollbackUpdateCommand(req);
|
RollbackUpdateCommand rollback = new RollbackUpdateCommand(req);
|
||||||
processor.processRollback(rollback);
|
processor.processRollback(rollback);
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
log.error("Exception while solr rollback.", t);
|
log.error("Exception while solr rollback.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ public class ZKPropertiesWriter extends SimplePropertiesWriter {
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
props.load(new StringReader(new String(data, "UTF-8")));
|
props.load(new StringReader(new String(data, "UTF-8")));
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
log.warn(
|
log.warn(
|
||||||
"Could not read DIH properties from " + path + " :" + e.getClass(), e);
|
"Could not read DIH properties from " + path + " :" + e.getClass(), e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,9 +114,9 @@ public class SolrLogFormatter extends Formatter {
|
||||||
public String format(LogRecord record) {
|
public String format(LogRecord record) {
|
||||||
try {
|
try {
|
||||||
return _format(record);
|
return _format(record);
|
||||||
} catch (Throwable th) {
|
} catch (Exception e) {
|
||||||
// logging swallows exceptions, so if we hit an exception we need to convert it to a string to see it
|
// logging swallows exceptions, so if we hit an exception we need to convert it to a string to see it
|
||||||
return "ERROR IN SolrLogFormatter! original message:" + record.getMessage() + "\n\tException: " + SolrException.toStr(th);
|
return "ERROR IN SolrLogFormatter! original message:" + record.getMessage() + "\n\tException: " + SolrException.toStr(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,7 +415,7 @@ sb.append("(group_name=").append(tg.getName()).append(")");
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
go();
|
go();
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -209,8 +209,8 @@ final class ShardLeaderElectionContext extends ShardLeaderElectionContextBase {
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
success = syncStrategy.sync(zkController, core, leaderProps);
|
success = syncStrategy.sync(zkController, core, leaderProps);
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, "Exception while trying to sync", t);
|
SolrException.log(log, "Exception while trying to sync", e);
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,12 +268,13 @@ final class ShardLeaderElectionContext extends ShardLeaderElectionContextBase {
|
||||||
core.close();
|
core.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
super.runLeaderProcess(weAreReplacement);
|
super.runLeaderProcess(weAreReplacement);
|
||||||
} catch (Throwable t) {
|
success = true;
|
||||||
SolrException.log(log, "There was a problem trying to register as the leader", t);
|
} catch (Exception e) {
|
||||||
cancelElection();
|
SolrException.log(log, "There was a problem trying to register as the leader", e);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
core = cc.getCore(coreName);
|
core = cc.getCore(coreName);
|
||||||
if (core == null) {
|
if (core == null) {
|
||||||
|
@ -287,9 +288,16 @@ final class ShardLeaderElectionContext extends ShardLeaderElectionContextBase {
|
||||||
// we could not publish ourselves as leader - rejoin election
|
// we could not publish ourselves as leader - rejoin election
|
||||||
rejoinLeaderElection(leaderSeqPath, core);
|
rejoinLeaderElection(leaderSeqPath, core);
|
||||||
} finally {
|
} finally {
|
||||||
if (core != null) {
|
try {
|
||||||
core.close();
|
if (!success) {
|
||||||
|
cancelElection();
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
if (core != null) {
|
||||||
|
core.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,11 +394,7 @@ final class ShardLeaderElectionContext extends ShardLeaderElectionContextBase {
|
||||||
|
|
||||||
cancelElection();
|
cancelElection();
|
||||||
|
|
||||||
try {
|
core.getUpdateHandler().getSolrCoreState().doRecovery(cc, core.getCoreDescriptor());
|
||||||
core.getUpdateHandler().getSolrCoreState().doRecovery(cc, core.getCoreDescriptor());
|
|
||||||
} catch (Throwable t) {
|
|
||||||
SolrException.log(log, "Error trying to start recovery", t);
|
|
||||||
}
|
|
||||||
|
|
||||||
leaderElector.joinElection(this, true);
|
leaderElector.joinElection(this, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -963,6 +963,7 @@ public class Overseer {
|
||||||
|
|
||||||
private String adminPath;
|
private String adminPath;
|
||||||
|
|
||||||
|
// overseer not responsible for closing reader
|
||||||
public Overseer(ShardHandler shardHandler, String adminPath, final ZkStateReader reader) throws KeeperException, InterruptedException {
|
public Overseer(ShardHandler shardHandler, String adminPath, final ZkStateReader reader) throws KeeperException, InterruptedException {
|
||||||
this.reader = reader;
|
this.reader = reader;
|
||||||
this.shardHandler = shardHandler;
|
this.shardHandler = shardHandler;
|
||||||
|
@ -992,20 +993,24 @@ public class Overseer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close() {
|
public void close() {
|
||||||
if (updaterThread != null) {
|
try {
|
||||||
try {
|
if (updaterThread != null) {
|
||||||
updaterThread.close();
|
try {
|
||||||
updaterThread.interrupt();
|
updaterThread.close();
|
||||||
} catch (Throwable t) {
|
updaterThread.interrupt();
|
||||||
log.error("Error closing updaterThread", t);
|
} catch (Exception e) {
|
||||||
|
log.error("Error closing updaterThread", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
} finally {
|
||||||
if (ccThread != null) {
|
|
||||||
try {
|
if (ccThread != null) {
|
||||||
ccThread.close();
|
try {
|
||||||
ccThread.interrupt();
|
ccThread.close();
|
||||||
} catch (Throwable t) {
|
ccThread.interrupt();
|
||||||
log.error("Error closing ccThread", t);
|
} catch (Exception e) {
|
||||||
|
log.error("Error closing ccThread", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updaterThread = null;
|
updaterThread = null;
|
||||||
|
|
|
@ -189,7 +189,7 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread {
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
return;
|
return;
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, "", e);
|
SolrException.log(log, "", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -255,13 +255,13 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread {
|
||||||
+ operation);
|
+ operation);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, "Collection " + operation + " of " + operation
|
SolrException.log(log, "Collection " + operation + " of " + operation
|
||||||
+ " failed", t);
|
+ " failed", e);
|
||||||
results.add("Operation " + operation + " caused exception:", t);
|
results.add("Operation " + operation + " caused exception:", e);
|
||||||
SimpleOrderedMap nl = new SimpleOrderedMap();
|
SimpleOrderedMap nl = new SimpleOrderedMap();
|
||||||
nl.add("msg", t.getMessage());
|
nl.add("msg", e.getMessage());
|
||||||
nl.add("rspCode", t instanceof SolrException ? ((SolrException)t).code() : -1);
|
nl.add("rspCode", e instanceof SolrException ? ((SolrException)e).code() : -1);
|
||||||
results.add("exception", nl);
|
results.add("exception", nl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -245,15 +245,15 @@ public class RecoveryStrategy extends Thread implements ClosableThread {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
doRecovery(core);
|
doRecovery(core);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
SolrException.log(log, "", e);
|
SolrException.log(log, "", e);
|
||||||
throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "",
|
throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "",
|
||||||
e);
|
e);
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
log.error("", t);
|
log.error("", e);
|
||||||
throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR,
|
throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR,
|
||||||
"", t);
|
"", e);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (core != null) core.close();
|
if (core != null) core.close();
|
||||||
|
@ -282,8 +282,8 @@ public class RecoveryStrategy extends Thread implements ClosableThread {
|
||||||
try {
|
try {
|
||||||
recentUpdates = ulog.getRecentUpdates();
|
recentUpdates = ulog.getRecentUpdates();
|
||||||
recentVersions = recentUpdates.getVersions(ulog.numRecordsToKeep);
|
recentVersions = recentUpdates.getVersions(ulog.numRecordsToKeep);
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, "Corrupt tlog - ignoring. core=" + coreName, t);
|
SolrException.log(log, "Corrupt tlog - ignoring. core=" + coreName, e);
|
||||||
recentVersions = new ArrayList<Long>(0);
|
recentVersions = new ArrayList<Long>(0);
|
||||||
} finally {
|
} finally {
|
||||||
if (recentUpdates != null) {
|
if (recentUpdates != null) {
|
||||||
|
@ -311,8 +311,8 @@ public class RecoveryStrategy extends Thread implements ClosableThread {
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("###### startupVersions=" + startingVersions);
|
log.info("###### startupVersions=" + startingVersions);
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, "Error getting recent versions. core=" + coreName, t);
|
SolrException.log(log, "Error getting recent versions. core=" + coreName, e);
|
||||||
recentVersions = new ArrayList<Long>(0);
|
recentVersions = new ArrayList<Long>(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -331,9 +331,9 @@ public class RecoveryStrategy extends Thread implements ClosableThread {
|
||||||
+ coreName);
|
+ coreName);
|
||||||
firstTime = false; // skip peersync
|
firstTime = false; // skip peersync
|
||||||
}
|
}
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, "Error trying to get ulog starting operation. core="
|
SolrException.log(log, "Error trying to get ulog starting operation. core="
|
||||||
+ coreName, t);
|
+ coreName, e);
|
||||||
firstTime = false; // skip peersync
|
firstTime = false; // skip peersync
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -449,21 +449,21 @@ public class RecoveryStrategy extends Thread implements ClosableThread {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
log.warn("Recovery was interrupted", e);
|
log.warn("Recovery was interrupted", e);
|
||||||
retries = INTERRUPTED;
|
retries = INTERRUPTED;
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, "Error while trying to recover", t);
|
SolrException.log(log, "Error while trying to recover", e);
|
||||||
} finally {
|
} finally {
|
||||||
if (!replayed) {
|
if (!replayed) {
|
||||||
try {
|
try {
|
||||||
ulog.dropBufferedUpdates();
|
ulog.dropBufferedUpdates();
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, "", t);
|
SolrException.log(log, "", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, "Error while trying to recover. core=" + coreName, t);
|
SolrException.log(log, "Error while trying to recover. core=" + coreName, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!successfulRecovery) {
|
if (!successfulRecovery) {
|
||||||
|
@ -486,9 +486,9 @@ public class RecoveryStrategy extends Thread implements ClosableThread {
|
||||||
try {
|
try {
|
||||||
recoveryFailed(core, zkController, baseUrl, coreZkNodeName,
|
recoveryFailed(core, zkController, baseUrl, coreZkNodeName,
|
||||||
core.getCoreDescriptor());
|
core.getCoreDescriptor());
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log,
|
SolrException.log(log,
|
||||||
"Could not publish that recovery failed", t);
|
"Could not publish that recovery failed", e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SolrException.log(log,
|
SolrException.log(log,
|
||||||
|
@ -496,15 +496,15 @@ public class RecoveryStrategy extends Thread implements ClosableThread {
|
||||||
try {
|
try {
|
||||||
recoveryFailed(core, zkController, baseUrl, coreZkNodeName,
|
recoveryFailed(core, zkController, baseUrl, coreZkNodeName,
|
||||||
core.getCoreDescriptor());
|
core.getCoreDescriptor());
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log,
|
SolrException.log(log,
|
||||||
"Could not publish that recovery failed", t);
|
"Could not publish that recovery failed", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, "core=" + coreName, e);
|
SolrException.log(log, "core=" + coreName, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,7 @@ public class SolrZkServer {
|
||||||
zkServer.runFromConfig(sc);
|
zkServer.runFromConfig(sc);
|
||||||
}
|
}
|
||||||
log.info("ZooKeeper Server exited.");
|
log.info("ZooKeeper Server exited.");
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
log.error("ZooKeeper Server ERROR", e);
|
log.error("ZooKeeper Server ERROR", e);
|
||||||
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
|
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,8 +211,8 @@ public class SyncStrategy {
|
||||||
} else {
|
} else {
|
||||||
requestRecovery(leaderProps, ((ShardCoreRequest)srsp.getShardRequest()).baseUrl, ((ShardCoreRequest)srsp.getShardRequest()).coreName);
|
requestRecovery(leaderProps, ((ShardCoreRequest)srsp.getShardRequest()).baseUrl, ((ShardCoreRequest)srsp.getShardRequest()).coreName);
|
||||||
}
|
}
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, ZkCoreNodeProps.getCoreUrl(leaderProps) + ": Could not tell a replica to recover", t);
|
SolrException.log(log, ZkCoreNodeProps.getCoreUrl(leaderProps) + ": Could not tell a replica to recover", e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.info(ZkCoreNodeProps.getCoreUrl(leaderProps) + ": " + " sync completed with " + srsp.getShardAddress());
|
log.info(ZkCoreNodeProps.getCoreUrl(leaderProps) + ": " + " sync completed with " + srsp.getShardAddress());
|
||||||
|
@ -278,6 +278,9 @@ public class SyncStrategy {
|
||||||
server.request(recoverRequestCmd);
|
server.request(recoverRequestCmd);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
SolrException.log(log, ZkCoreNodeProps.getCoreUrl(leaderProps) + ": Could not tell a replica to recover", t);
|
SolrException.log(log, ZkCoreNodeProps.getCoreUrl(leaderProps) + ": Could not tell a replica to recover", t);
|
||||||
|
if (t instanceof Error) {
|
||||||
|
throw (Error) t;
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
server.shutdown();
|
server.shutdown();
|
||||||
}
|
}
|
||||||
|
|
|
@ -249,8 +249,8 @@ public final class ZkController {
|
||||||
// with connection loss
|
// with connection loss
|
||||||
try {
|
try {
|
||||||
register(descriptor.getName(), descriptor, true, true);
|
register(descriptor.getName(), descriptor, true, true);
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, "Error registering SolrCore", t);
|
SolrException.log(log, "Error registering SolrCore", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -385,33 +385,38 @@ public final class ZkController {
|
||||||
*/
|
*/
|
||||||
public void close() {
|
public void close() {
|
||||||
this.isClosed = true;
|
this.isClosed = true;
|
||||||
|
try {
|
||||||
for (ElectionContext context : electionContexts.values()) {
|
for (ElectionContext context : electionContexts.values()) {
|
||||||
|
try {
|
||||||
|
context.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Error closing overseer", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
try {
|
try {
|
||||||
context.close();
|
try {
|
||||||
} catch (Throwable t) {
|
overseer.close();
|
||||||
log.error("Error closing overseer", t);
|
} catch (Exception e) {
|
||||||
|
log.error("Error closing overseer", e);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
try {
|
||||||
|
zkStateReader.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Error closing zkStateReader", e);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
zkClient.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Error closing zkClient", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
overseer.close();
|
|
||||||
} catch(Throwable t) {
|
|
||||||
log.error("Error closing overseer", t);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
zkStateReader.close();
|
|
||||||
} catch(Throwable t) {
|
|
||||||
log.error("Error closing zkStateReader", t);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
zkClient.close();;
|
|
||||||
} catch(Throwable t) {
|
|
||||||
log.error("Error closing zkClient", t);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -473,7 +478,7 @@ public final class ZkController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log,
|
SolrException.log(log,
|
||||||
"Error while looking for a better host name than 127.0.0.1", e);
|
"Error while looking for a better host name than 127.0.0.1", e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,8 +186,8 @@ public abstract class CachingDirectoryFactory extends DirectoryFactory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert val.refCnt == 0 : val.refCnt;
|
assert val.refCnt == 0 : val.refCnt;
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, "Error closing directory", t);
|
SolrException.log(log, "Error closing directory", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,8 +203,8 @@ public abstract class CachingDirectoryFactory extends DirectoryFactory {
|
||||||
closedDirs.add(v);
|
closedDirs.add(v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, "Error closing directory", t);
|
SolrException.log(log, "Error closing directory", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,8 +212,8 @@ public abstract class CachingDirectoryFactory extends DirectoryFactory {
|
||||||
log.info("Removing directory after core close: " + val.path);
|
log.info("Removing directory after core close: " + val.path);
|
||||||
try {
|
try {
|
||||||
removeDirectory(val);
|
removeDirectory(val);
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, "Error removing directory", t);
|
SolrException.log(log, "Error removing directory", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,8 +238,8 @@ public abstract class CachingDirectoryFactory extends DirectoryFactory {
|
||||||
for (CloseListener listener : listeners) {
|
for (CloseListener listener : listeners) {
|
||||||
try {
|
try {
|
||||||
listener.preClose();
|
listener.preClose();
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, "Error executing preClose for directory", t);
|
SolrException.log(log, "Error executing preClose for directory", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -279,8 +279,8 @@ public abstract class CachingDirectoryFactory extends DirectoryFactory {
|
||||||
log.info("Removing directory before core close: " + val.path);
|
log.info("Removing directory before core close: " + val.path);
|
||||||
try {
|
try {
|
||||||
removeDirectory(val);
|
removeDirectory(val);
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, "Error removing directory", t);
|
SolrException.log(log, "Error removing directory", e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
removeEntries.add(val);
|
removeEntries.add(val);
|
||||||
|
@ -291,8 +291,8 @@ public abstract class CachingDirectoryFactory extends DirectoryFactory {
|
||||||
for (CloseListener listener : listeners) {
|
for (CloseListener listener : listeners) {
|
||||||
try {
|
try {
|
||||||
listener.postClose();
|
listener.postClose();
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, "Error executing postClose for directory", t);
|
SolrException.log(log, "Error executing postClose for directory", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -303,8 +303,8 @@ public abstract class CachingDirectoryFactory extends DirectoryFactory {
|
||||||
try {
|
try {
|
||||||
log.info("Closing directory: " + val.path);
|
log.info("Closing directory: " + val.path);
|
||||||
val.directory.close();
|
val.directory.close();
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, "Error closing directory", t);
|
SolrException.log(log, "Error closing directory", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -260,7 +260,7 @@ public class Config {
|
||||||
throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Error in xpath:" + xstr + " for " + name,e);
|
throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Error in xpath:" + xstr + " for " + name,e);
|
||||||
} catch (SolrException e) {
|
} catch (SolrException e) {
|
||||||
throw(e);
|
throw(e);
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log,"Error in xpath",e);
|
SolrException.log(log,"Error in xpath",e);
|
||||||
throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Error in xpath:" + xstr+ " for " + name,e);
|
throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Error in xpath:" + xstr+ " for " + name,e);
|
||||||
}
|
}
|
||||||
|
@ -290,7 +290,7 @@ public class Config {
|
||||||
throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Error in xpath:" + xstr + " for " + name,e);
|
throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Error in xpath:" + xstr + " for " + name,e);
|
||||||
} catch (SolrException e) {
|
} catch (SolrException e) {
|
||||||
throw(e);
|
throw(e);
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log,"Error in xpath",e);
|
SolrException.log(log,"Error in xpath",e);
|
||||||
throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Error in xpath:" + xstr+ " for " + name,e);
|
throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Error in xpath:" + xstr+ " for " + name,e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.solr.core;
|
||||||
|
|
||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
import com.google.common.io.ByteStreams;
|
import com.google.common.io.ByteStreams;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.solr.common.SolrException;
|
import org.apache.solr.common.SolrException;
|
||||||
import org.apache.solr.logging.LogWatcherConfig;
|
import org.apache.solr.logging.LogWatcherConfig;
|
||||||
|
@ -33,6 +34,7 @@ import org.xml.sax.InputSource;
|
||||||
import javax.xml.xpath.XPath;
|
import javax.xml.xpath.XPath;
|
||||||
import javax.xml.xpath.XPathConstants;
|
import javax.xml.xpath.XPathConstants;
|
||||||
import javax.xml.xpath.XPathExpressionException;
|
import javax.xml.xpath.XPathExpressionException;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -288,7 +290,7 @@ public abstract class ConfigSolr {
|
||||||
try {
|
try {
|
||||||
return readProperties(((NodeList) config.evaluate(
|
return readProperties(((NodeList) config.evaluate(
|
||||||
path, XPathConstants.NODESET)).item(0));
|
path, XPathConstants.NODESET)).item(0));
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, null, e);
|
SolrException.log(log, null, e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -257,21 +257,24 @@ public class CoreContainer {
|
||||||
}
|
}
|
||||||
c = create(cd);
|
c = create(cd);
|
||||||
registerCore(cd.isTransient(), name, c, false, false);
|
registerCore(cd.isTransient(), name, c, false, false);
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
|
SolrException.log(log, null, e);
|
||||||
|
try {
|
||||||
/* if (isZooKeeperAware()) {
|
/* if (isZooKeeperAware()) {
|
||||||
try {
|
try {
|
||||||
zkSys.zkController.unregister(name, cd);
|
zkSys.zkController.unregister(name, cd);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e2) {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
SolrException.log(log, null, e);
|
SolrException.log(log, null, e2);
|
||||||
} catch (KeeperException e) {
|
} catch (KeeperException e3) {
|
||||||
SolrException.log(log, null, e);
|
SolrException.log(log, null, e3);
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
SolrException.log(log, null, t);
|
} finally {
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
c.close();
|
c.close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
@ -279,8 +282,8 @@ public class CoreContainer {
|
||||||
pending.add(completionService.submit(task));
|
pending.add(completionService.submit(task));
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (Throwable ex) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, null, ex);
|
SolrException.log(log, null, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,8 +419,8 @@ public class CoreContainer {
|
||||||
for (SolrCore core : cores) {
|
for (SolrCore core : cores) {
|
||||||
try {
|
try {
|
||||||
core.getSolrCoreState().cancelRecovery();
|
core.getSolrCoreState().cancelRecovery();
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, "Error canceling recovery for core", t);
|
SolrException.log(log, "Error canceling recovery for core", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,8 +33,8 @@ public class Diagnostics {
|
||||||
public static void call(Callable callable, Object... data) {
|
public static void call(Callable callable, Object... data) {
|
||||||
try {
|
try {
|
||||||
callable.call(data);
|
callable.call(data);
|
||||||
} catch (Throwable th) {
|
} catch (Exception e) {
|
||||||
log.error("TEST HOOK EXCEPTION", th);
|
log.error("TEST HOOK EXCEPTION", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -834,7 +834,11 @@ public final class SolrCore implements SolrInfoMBean {
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
latch.countDown();//release the latch, otherwise we block trying to do the close. This should be fine, since counting down on a latch of 0 is still fine
|
latch.countDown();//release the latch, otherwise we block trying to do the close. This should be fine, since counting down on a latch of 0 is still fine
|
||||||
//close down the searcher and any other resources, if it exists, as this is not recoverable
|
//close down the searcher and any other resources, if it exists, as this is not recoverable
|
||||||
|
if (e instanceof OutOfMemoryError) {
|
||||||
|
throw (OutOfMemoryError)e;
|
||||||
|
}
|
||||||
close();
|
close();
|
||||||
|
|
||||||
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
|
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
|
||||||
e.getMessage(), e);
|
e.getMessage(), e);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -1002,7 +1006,10 @@ public final class SolrCore implements SolrInfoMBean {
|
||||||
try {
|
try {
|
||||||
hook.preClose( this );
|
hook.preClose( this );
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
SolrException.log(log, e);
|
SolrException.log(log, e);
|
||||||
|
if (e instanceof Error) {
|
||||||
|
throw (Error) e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1012,6 +1019,9 @@ public final class SolrCore implements SolrInfoMBean {
|
||||||
infoRegistry.clear();
|
infoRegistry.clear();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
SolrException.log(log, e);
|
SolrException.log(log, e);
|
||||||
|
if (e instanceof Error) {
|
||||||
|
throw (Error) e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -1020,6 +1030,9 @@ public final class SolrCore implements SolrInfoMBean {
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
SolrException.log(log,e);
|
SolrException.log(log,e);
|
||||||
|
if (e instanceof Error) {
|
||||||
|
throw (Error) e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean coreStateClosed = false;
|
boolean coreStateClosed = false;
|
||||||
|
@ -1033,12 +1046,18 @@ public final class SolrCore implements SolrInfoMBean {
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
SolrException.log(log, e);
|
SolrException.log(log, e);
|
||||||
|
if (e instanceof Error) {
|
||||||
|
throw (Error) e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ExecutorUtil.shutdownAndAwaitTermination(searcherExecutor);
|
ExecutorUtil.shutdownAndAwaitTermination(searcherExecutor);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
SolrException.log(log, e);
|
SolrException.log(log, e);
|
||||||
|
if (e instanceof Error) {
|
||||||
|
throw (Error) e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -1052,14 +1071,20 @@ public final class SolrCore implements SolrInfoMBean {
|
||||||
closeSearcher();
|
closeSearcher();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
SolrException.log(log,e);
|
SolrException.log(log,e);
|
||||||
|
if (e instanceof Error) {
|
||||||
|
throw (Error) e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (coreStateClosed) {
|
if (coreStateClosed) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
directoryFactory.close();
|
directoryFactory.close();
|
||||||
} catch (Throwable t) {
|
} catch (Throwable e) {
|
||||||
SolrException.log(log, t);
|
SolrException.log(log, e);
|
||||||
|
if (e instanceof Error) {
|
||||||
|
throw (Error) e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1071,6 +1096,9 @@ public final class SolrCore implements SolrInfoMBean {
|
||||||
hook.postClose( this );
|
hook.postClose( this );
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
SolrException.log(log, e);
|
SolrException.log(log, e);
|
||||||
|
if (e instanceof Error) {
|
||||||
|
throw (Error) e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1646,6 +1674,9 @@ public final class SolrCore implements SolrInfoMBean {
|
||||||
newSearcher.warm(currSearcher);
|
newSearcher.warm(currSearcher);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
SolrException.log(log,e);
|
SolrException.log(log,e);
|
||||||
|
if (e instanceof Error) {
|
||||||
|
throw (Error) e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -1664,6 +1695,9 @@ public final class SolrCore implements SolrInfoMBean {
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
SolrException.log(log,null,e);
|
SolrException.log(log,null,e);
|
||||||
|
if (e instanceof Error) {
|
||||||
|
throw (Error) e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -1682,6 +1716,9 @@ public final class SolrCore implements SolrInfoMBean {
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
SolrException.log(log,null,e);
|
SolrException.log(log,null,e);
|
||||||
|
if (e instanceof Error) {
|
||||||
|
throw (Error) e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -1703,6 +1740,9 @@ public final class SolrCore implements SolrInfoMBean {
|
||||||
registerSearcher(newSearchHolder);
|
registerSearcher(newSearchHolder);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
SolrException.log(log, e);
|
SolrException.log(log, e);
|
||||||
|
if (e instanceof Error) {
|
||||||
|
throw (Error) e;
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
// we are all done with the old searcher we used
|
// we are all done with the old searcher we used
|
||||||
// for warming...
|
// for warming...
|
||||||
|
@ -1778,7 +1818,7 @@ public final class SolrCore implements SolrInfoMBean {
|
||||||
searcherList.remove(this);
|
searcherList.remove(this);
|
||||||
}
|
}
|
||||||
resource.close();
|
resource.close();
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
// do not allow decref() operations to fail since they are typically called in finally blocks
|
// do not allow decref() operations to fail since they are typically called in finally blocks
|
||||||
// and throwing another exception would be very unexpected.
|
// and throwing another exception would be very unexpected.
|
||||||
SolrException.log(log, "Error closing searcher:" + this, e);
|
SolrException.log(log, "Error closing searcher:" + this, e);
|
||||||
|
@ -1826,7 +1866,7 @@ public final class SolrCore implements SolrInfoMBean {
|
||||||
newSearcher.register(); // register subitems (caches)
|
newSearcher.register(); // register subitems (caches)
|
||||||
log.info(logid+"Registered new searcher " + newSearcher);
|
log.info(logid+"Registered new searcher " + newSearcher);
|
||||||
|
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
// an exception in register() shouldn't be fatal.
|
// an exception in register() shouldn't be fatal.
|
||||||
log(e);
|
log(e);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -1871,8 +1911,8 @@ public final class SolrCore implements SolrInfoMBean {
|
||||||
// if (req.getParams().getBool(ShardParams.IS_SHARD,false) && !(handler instanceof SearchHandler))
|
// if (req.getParams().getBool(ShardParams.IS_SHARD,false) && !(handler instanceof SearchHandler))
|
||||||
// throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,"isShard is only acceptable with search handlers");
|
// throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,"isShard is only acceptable with search handlers");
|
||||||
|
|
||||||
handler.handleRequest(req,rsp);
|
|
||||||
|
|
||||||
|
handler.handleRequest(req,rsp);
|
||||||
postDecorateResponse(handler, req, rsp);
|
postDecorateResponse(handler, req, rsp);
|
||||||
|
|
||||||
if (log.isInfoEnabled() && rsp.getToLog().size() > 0) {
|
if (log.isInfoEnabled() && rsp.getToLog().size() > 0) {
|
||||||
|
|
|
@ -118,8 +118,11 @@ class SolrCores {
|
||||||
for (SolrCore core : coreList) {
|
for (SolrCore core : coreList) {
|
||||||
try {
|
try {
|
||||||
core.close();
|
core.close();
|
||||||
} catch (Throwable t) {
|
} catch (Throwable e) {
|
||||||
SolrException.log(CoreContainer.log, "Error shutting down core", t);
|
SolrException.log(CoreContainer.log, "Error shutting down core", e);
|
||||||
|
if (e instanceof Error) {
|
||||||
|
throw (Error) e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (coreList.size() > 0);
|
} while (coreList.size() > 0);
|
||||||
|
|
|
@ -675,8 +675,8 @@ public class SolrResourceLoader implements ResourceLoader,Closeable
|
||||||
for (SolrInfoMBean bean : arr) {
|
for (SolrInfoMBean bean : arr) {
|
||||||
try {
|
try {
|
||||||
infoRegistry.put(bean.getName(), bean);
|
infoRegistry.put(bean.getName(), bean);
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
log.warn("could not register MBean '" + bean.getName() + "'.", t);
|
log.warn("could not register MBean '" + bean.getName() + "'.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -253,8 +253,8 @@ public class PingRequestHandler extends RequestHandlerBase implements SolrCoreAw
|
||||||
core.execute(handler, req, pingrsp );
|
core.execute(handler, req, pingrsp );
|
||||||
ex = pingrsp.getException();
|
ex = pingrsp.getException();
|
||||||
}
|
}
|
||||||
catch( Throwable th ) {
|
catch( Exception e ) {
|
||||||
ex = th;
|
ex = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send an error or an 'OK' message (response code will be 200)
|
// Send an error or an 'OK' message (response code will be 200)
|
||||||
|
|
|
@ -1356,10 +1356,10 @@ public class SnapPuller {
|
||||||
is = new InflaterInputStream(is);
|
is = new InflaterInputStream(is);
|
||||||
}
|
}
|
||||||
return new FastInputStream(is);
|
return new FastInputStream(is);
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
//close stream on error
|
//close stream on error
|
||||||
IOUtils.closeQuietly(is);
|
IOUtils.closeQuietly(is);
|
||||||
throw new IOException("Could not download file '" + fileName + "'", t);
|
throw new IOException("Could not download file '" + fileName + "'", e);
|
||||||
} finally {
|
} finally {
|
||||||
s.shutdown();
|
s.shutdown();
|
||||||
}
|
}
|
||||||
|
@ -1620,10 +1620,10 @@ public class SnapPuller {
|
||||||
is = new InflaterInputStream(is);
|
is = new InflaterInputStream(is);
|
||||||
}
|
}
|
||||||
return new FastInputStream(is);
|
return new FastInputStream(is);
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
//close stream on error
|
//close stream on error
|
||||||
IOUtils.closeQuietly(is);
|
IOUtils.closeQuietly(is);
|
||||||
throw new IOException("Could not download file '" + fileName + "'", t);
|
throw new IOException("Could not download file '" + fileName + "'", e);
|
||||||
} finally {
|
} finally {
|
||||||
s.shutdown();
|
s.shutdown();
|
||||||
}
|
}
|
||||||
|
@ -1683,19 +1683,13 @@ public class SnapPuller {
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
try {
|
try {
|
||||||
if (executorService != null) executorService.shutdown();
|
if (executorService != null) executorService.shutdown();
|
||||||
} catch (Throwable e) {
|
} finally {
|
||||||
SolrException.log(LOG, e);
|
try {
|
||||||
}
|
abortPull();
|
||||||
try {
|
} finally {
|
||||||
abortPull();
|
if (executorService != null) ExecutorUtil
|
||||||
} catch (Throwable e) {
|
.shutdownNowAndAwaitTermination(executorService);
|
||||||
SolrException.log(LOG, e);
|
}
|
||||||
}
|
|
||||||
try {
|
|
||||||
if (executorService != null) ExecutorUtil
|
|
||||||
.shutdownNowAndAwaitTermination(executorService);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
SolrException.log(LOG, e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -766,8 +766,11 @@ public class CoreAdminHandler extends RequestHandlerBase {
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
SolrException.log(log, "", e);
|
SolrException.log(log, "", e);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable e) {
|
||||||
SolrException.log(log, "", t);
|
SolrException.log(log, "", e);
|
||||||
|
if (e instanceof Error) {
|
||||||
|
throw (Error) e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
core.getUpdateHandler().getSolrCoreState().doRecovery(coreContainer, core.getCoreDescriptor());
|
core.getUpdateHandler().getSolrCoreState().doRecovery(coreContainer, core.getCoreDescriptor());
|
||||||
|
@ -1005,7 +1008,7 @@ public class CoreAdminHandler extends RequestHandlerBase {
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
log.warn("Recovery was interrupted", e);
|
log.warn("Recovery was interrupted", e);
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
if (e instanceof SolrException)
|
if (e instanceof SolrException)
|
||||||
throw (SolrException)e;
|
throw (SolrException)e;
|
||||||
else
|
else
|
||||||
|
|
|
@ -177,7 +177,7 @@ public class SystemInfoHandler extends RequestHandlerBase
|
||||||
info.add( "uptime", execute( "uptime" ) );
|
info.add( "uptime", execute( "uptime" ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( Throwable ex ) {
|
catch( Exception ex ) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
return info;
|
return info;
|
||||||
|
|
|
@ -165,7 +165,7 @@ public class HttpShardHandler extends ShardHandler {
|
||||||
}
|
}
|
||||||
catch( ConnectException cex ) {
|
catch( ConnectException cex ) {
|
||||||
srsp.setException(cex); //????
|
srsp.setException(cex); //????
|
||||||
} catch (Throwable th) {
|
} catch (Exception th) {
|
||||||
srsp.setException(th);
|
srsp.setException(th);
|
||||||
if (th instanceof SolrException) {
|
if (th instanceof SolrException) {
|
||||||
srsp.setResponseCode(((SolrException)th).code());
|
srsp.setResponseCode(((SolrException)th).code());
|
||||||
|
|
|
@ -175,25 +175,18 @@ public class HttpShardHandlerFactory extends ShardHandlerFactory implements org.
|
||||||
public void close() {
|
public void close() {
|
||||||
try {
|
try {
|
||||||
ExecutorUtil.shutdownNowAndAwaitTermination(commExecutor);
|
ExecutorUtil.shutdownNowAndAwaitTermination(commExecutor);
|
||||||
} catch (Throwable e) {
|
} finally {
|
||||||
SolrException.log(log, e);
|
try {
|
||||||
}
|
if (defaultClient != null) {
|
||||||
|
defaultClient.getConnectionManager().shutdown();
|
||||||
try {
|
}
|
||||||
if(defaultClient != null) {
|
} finally {
|
||||||
defaultClient.getConnectionManager().shutdown();
|
|
||||||
|
if (loadbalancer != null) {
|
||||||
|
loadbalancer.shutdown();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
|
||||||
SolrException.log(log, e);
|
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
if(loadbalancer != null) {
|
|
||||||
loadbalancer.shutdown();
|
|
||||||
}
|
|
||||||
} catch (Throwable e) {
|
|
||||||
SolrException.log(log, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -161,6 +161,9 @@ public abstract class LogWatcher<E> {
|
||||||
}
|
}
|
||||||
catch (Throwable e) {
|
catch (Throwable e) {
|
||||||
log.warn("Unable to read SLF4J version. LogWatcher will be disabled: " + e);
|
log.warn("Unable to read SLF4J version. LogWatcher will be disabled: " + e);
|
||||||
|
if (e instanceof OutOfMemoryError) {
|
||||||
|
throw (OutOfMemoryError) e;
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,6 +182,9 @@ public abstract class LogWatcher<E> {
|
||||||
}
|
}
|
||||||
catch (Throwable e) {
|
catch (Throwable e) {
|
||||||
log.warn("Unable to load LogWatcher {}: {}", fname, e);
|
log.warn("Unable to load LogWatcher {}: {}", fname, e);
|
||||||
|
if (e instanceof OutOfMemoryError) {
|
||||||
|
throw (OutOfMemoryError) e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -64,8 +64,8 @@ public class SolrRequestInfo {
|
||||||
for (Closeable hook : info.closeHooks) {
|
for (Closeable hook : info.closeHooks) {
|
||||||
try {
|
try {
|
||||||
hook.close();
|
hook.close();
|
||||||
} catch (Throwable throwable) {
|
} catch (Exception e) {
|
||||||
SolrException.log(SolrCore.log, "Exception during close hook", throwable);
|
SolrException.log(SolrCore.log, "Exception during close hook", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,6 +134,9 @@ abstract class BaseSchemaResource extends ServerResource {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
|
if (t instanceof OutOfMemoryError) {
|
||||||
|
throw (OutOfMemoryError) t;
|
||||||
|
}
|
||||||
setExisting(false);
|
setExisting(false);
|
||||||
throw new ResourceException(t);
|
throw new ResourceException(t);
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,7 +160,7 @@ public class FastLRUCache<K,V> extends SolrCacheBase implements SolrCache<K,V> {
|
||||||
this, old, itemsArr[i].getKey(), itemsArr[i].getValue());
|
this, old, itemsArr[i].getKey(), itemsArr[i].getValue());
|
||||||
if (!continueRegen) break;
|
if (!continueRegen) break;
|
||||||
}
|
}
|
||||||
catch (Throwable e) {
|
catch (Exception e) {
|
||||||
SolrException.log(log, "Error during auto-warming of key:" + itemsArr[i].getKey(), e);
|
SolrException.log(log, "Error during auto-warming of key:" + itemsArr[i].getKey(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,7 +182,7 @@ public class LFUCache<K, V> implements SolrCache<K, V> {
|
||||||
boolean continueRegen = regenerator.regenerateItem(searcher,
|
boolean continueRegen = regenerator.regenerateItem(searcher,
|
||||||
this, old, itemsArr[i].getKey(), itemsArr[i].getValue());
|
this, old, itemsArr[i].getKey(), itemsArr[i].getValue());
|
||||||
if (!continueRegen) break;
|
if (!continueRegen) break;
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, "Error during auto-warming of key:" + itemsArr[i].getKey(), e);
|
SolrException.log(log, "Error during auto-warming of key:" + itemsArr[i].getKey(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,7 +188,7 @@ public class LRUCache<K,V> extends SolrCacheBase implements SolrCache<K,V> {
|
||||||
boolean continueRegen = regenerator.regenerateItem(searcher, this, old, keys[i], vals[i]);
|
boolean continueRegen = regenerator.regenerateItem(searcher, this, old, keys[i], vals[i]);
|
||||||
if (!continueRegen) break;
|
if (!continueRegen) break;
|
||||||
}
|
}
|
||||||
catch (Throwable e) {
|
catch (Exception e) {
|
||||||
SolrException.log(log,"Error during auto-warming of key:" + keys[i], e);
|
SolrException.log(log,"Error during auto-warming of key:" + keys[i], e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,9 +175,9 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable,SolrIn
|
||||||
Directory dir = directoryFactory.get(path, DirContext.DEFAULT, config.lockType);
|
Directory dir = directoryFactory.get(path, DirContext.DEFAULT, config.lockType);
|
||||||
try {
|
try {
|
||||||
reader = core.getIndexReaderFactory().newReader(dir, core);
|
reader = core.getIndexReaderFactory().newReader(dir, core);
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
directoryFactory.release(dir);
|
directoryFactory.release(dir);
|
||||||
throw new SolrException(ErrorCode.SERVER_ERROR, "Error opening Reader", t);
|
throw new SolrException(ErrorCode.SERVER_ERROR, "Error opening Reader", e);
|
||||||
}
|
}
|
||||||
return reader;
|
return reader;
|
||||||
}
|
}
|
||||||
|
@ -347,8 +347,8 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable,SolrIn
|
||||||
long cpg = reader.getIndexCommit().getGeneration();
|
long cpg = reader.getIndexCommit().getGeneration();
|
||||||
try {
|
try {
|
||||||
if (closeReader) reader.decRef();
|
if (closeReader) reader.decRef();
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, "Problem dec ref'ing reader", t);
|
SolrException.log(log, "Problem dec ref'ing reader", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (directoryFactory.searchersReserveCommitPoints()) {
|
if (directoryFactory.searchersReserveCommitPoints()) {
|
||||||
|
|
|
@ -136,6 +136,9 @@ public class SolrDispatchFilter implements Filter
|
||||||
// catch this so our filter still works
|
// catch this so our filter still works
|
||||||
log.error( "Could not start Solr. Check solr/home property and the logs");
|
log.error( "Could not start Solr. Check solr/home property and the logs");
|
||||||
SolrCore.log( t );
|
SolrCore.log( t );
|
||||||
|
if (t instanceof Error) {
|
||||||
|
throw (Error) t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("SolrDispatchFilter.init() done");
|
log.info("SolrDispatchFilter.init() done");
|
||||||
|
@ -434,17 +437,25 @@ public class SolrDispatchFilter implements Filter
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Throwable ex) {
|
||||||
sendError( core, solrReq, request, (HttpServletResponse)response, ex );
|
sendError( core, solrReq, request, (HttpServletResponse)response, ex );
|
||||||
|
if (ex instanceof Error) {
|
||||||
|
throw (Error) ex;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
} finally {
|
||||||
finally {
|
try {
|
||||||
if( solrReq != null ) {
|
if (solrReq != null) {
|
||||||
log.debug("Closing out SolrRequest: {}", solrReq);
|
log.debug("Closing out SolrRequest: {}", solrReq);
|
||||||
solrReq.close();
|
solrReq.close();
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (core != null) {
|
||||||
|
core.close();
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
SolrRequestInfo.clearRequestInfo();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (core != null) {
|
|
||||||
core.close();
|
|
||||||
}
|
|
||||||
SolrRequestInfo.clearRequestInfo();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -758,6 +769,7 @@ public class SolrDispatchFilter implements Filter
|
||||||
ServletRequest request,
|
ServletRequest request,
|
||||||
HttpServletResponse response,
|
HttpServletResponse response,
|
||||||
Throwable ex) throws IOException {
|
Throwable ex) throws IOException {
|
||||||
|
Exception exp = null;
|
||||||
SolrCore localCore = null;
|
SolrCore localCore = null;
|
||||||
try {
|
try {
|
||||||
SolrQueryResponse solrResp = new SolrQueryResponse();
|
SolrQueryResponse solrResp = new SolrQueryResponse();
|
||||||
|
@ -786,15 +798,21 @@ public class SolrDispatchFilter implements Filter
|
||||||
QueryResponseWriter writer = core.getQueryResponseWriter(req);
|
QueryResponseWriter writer = core.getQueryResponseWriter(req);
|
||||||
writeResponse(solrResp, response, writer, req, Method.GET);
|
writeResponse(solrResp, response, writer, req, Method.GET);
|
||||||
}
|
}
|
||||||
catch( Throwable t ) { // This error really does not matter
|
catch (Exception e) { // This error really does not matter
|
||||||
SimpleOrderedMap info = new SimpleOrderedMap();
|
exp = e;
|
||||||
int code = ResponseUtils.getErrorInfo(ex, info, log);
|
|
||||||
response.sendError( code, info.toString() );
|
|
||||||
} finally {
|
} finally {
|
||||||
if (core == null && localCore != null) {
|
try {
|
||||||
localCore.close();
|
if (exp != null) {
|
||||||
|
SimpleOrderedMap info = new SimpleOrderedMap();
|
||||||
|
int code = ResponseUtils.getErrorInfo(ex, info, log);
|
||||||
|
response.sendError(code, info.toString());
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
if (core == null && localCore != null) {
|
||||||
|
localCore.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
|
|
|
@ -71,8 +71,8 @@ public final class DefaultSolrCoreState extends SolrCoreState implements Recover
|
||||||
indexWriter.close();
|
indexWriter.close();
|
||||||
}
|
}
|
||||||
indexWriter = null;
|
indexWriter = null;
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
log.error("Error during shutdown of writer.", t);
|
log.error("Error during shutdown of writer.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,17 +162,17 @@ public final class DefaultSolrCoreState extends SolrCoreState implements Recover
|
||||||
try {
|
try {
|
||||||
log.info("Closing old IndexWriter... core=" + coreName);
|
log.info("Closing old IndexWriter... core=" + coreName);
|
||||||
indexWriter.close();
|
indexWriter.close();
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, "Error closing old IndexWriter. core="
|
SolrException.log(log, "Error closing old IndexWriter. core="
|
||||||
+ coreName, t);
|
+ coreName, e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
log.info("Rollback old IndexWriter... core=" + coreName);
|
log.info("Rollback old IndexWriter... core=" + coreName);
|
||||||
indexWriter.rollback();
|
indexWriter.rollback();
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, "Error rolling back old IndexWriter. core="
|
SolrException.log(log, "Error rolling back old IndexWriter. core="
|
||||||
+ coreName, t);
|
+ coreName, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -220,17 +220,17 @@ public final class DefaultSolrCoreState extends SolrCoreState implements Recover
|
||||||
try {
|
try {
|
||||||
log.info("Closing old IndexWriter... core=" + coreName);
|
log.info("Closing old IndexWriter... core=" + coreName);
|
||||||
indexWriter.close();
|
indexWriter.close();
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, "Error closing old IndexWriter. core="
|
SolrException.log(log, "Error closing old IndexWriter. core="
|
||||||
+ coreName, t);
|
+ coreName, e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
log.info("Rollback old IndexWriter... core=" + coreName);
|
log.info("Rollback old IndexWriter... core=" + coreName);
|
||||||
indexWriter.rollback();
|
indexWriter.rollback();
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, "Error rolling back old IndexWriter. core="
|
SolrException.log(log, "Error rolling back old IndexWriter. core="
|
||||||
+ coreName, t);
|
+ coreName, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -751,6 +751,9 @@ public class DirectUpdateHandler2 extends UpdateHandler implements SolrCoreState
|
||||||
}
|
}
|
||||||
} catch (Throwable th) {
|
} catch (Throwable th) {
|
||||||
log.error("Error in final commit", th);
|
log.error("Error in final commit", th);
|
||||||
|
if (th instanceof OutOfMemoryError) {
|
||||||
|
throw (OutOfMemoryError) th;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// we went through the normal process to commit, so we don't have to artificially
|
// we went through the normal process to commit, so we don't have to artificially
|
||||||
|
@ -759,6 +762,9 @@ public class DirectUpdateHandler2 extends UpdateHandler implements SolrCoreState
|
||||||
if (ulog != null) ulog.close(false);
|
if (ulog != null) ulog.close(false);
|
||||||
} catch (Throwable th) {
|
} catch (Throwable th) {
|
||||||
log.error("Error closing log files", th);
|
log.error("Error closing log files", th);
|
||||||
|
if (th instanceof OutOfMemoryError) {
|
||||||
|
throw (OutOfMemoryError) th;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (writer != null) writer.close();
|
if (writer != null) writer.close();
|
||||||
|
|
|
@ -70,8 +70,8 @@ public abstract class SolrCoreState {
|
||||||
try {
|
try {
|
||||||
log.info("Closing SolrCoreState");
|
log.info("Closing SolrCoreState");
|
||||||
close(closer);
|
close(closer);
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
log.error("Error closing SolrCoreState", t);
|
log.error("Error closing SolrCoreState", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return close;
|
return close;
|
||||||
|
|
|
@ -134,14 +134,17 @@ public class SolrIndexWriter extends IndexWriter {
|
||||||
// don't allow interruption
|
// don't allow interruption
|
||||||
continue;
|
continue;
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
|
if (t instanceof OutOfMemoryError) {
|
||||||
|
throw (OutOfMemoryError) t;
|
||||||
|
}
|
||||||
log.error("Error closing IndexWriter, trying rollback", t);
|
log.error("Error closing IndexWriter, trying rollback", t);
|
||||||
super.rollback();
|
super.rollback();
|
||||||
}
|
}
|
||||||
if (IndexWriter.isLocked(directory)) {
|
if (IndexWriter.isLocked(directory)) {
|
||||||
try {
|
try {
|
||||||
IndexWriter.unlock(directory);
|
IndexWriter.unlock(directory);
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
log.error("Coud not unlock directory after seemingly failed IndexWriter#close()", t);
|
log.error("Coud not unlock directory after seemingly failed IndexWriter#close()", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -421,7 +421,7 @@ public class UpdateLog implements PluginInfoInitialized {
|
||||||
try {
|
try {
|
||||||
RefCounted<SolrIndexSearcher> holder = uhandler.core.openNewSearcher(true, true);
|
RefCounted<SolrIndexSearcher> holder = uhandler.core.openNewSearcher(true, true);
|
||||||
holder.decref();
|
holder.decref();
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, "Error opening realtime searcher for deleteByQuery", e);
|
SolrException.log(log, "Error opening realtime searcher for deleteByQuery", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -491,7 +491,7 @@ public class UpdateLog implements PluginInfoInitialized {
|
||||||
try {
|
try {
|
||||||
RefCounted<SolrIndexSearcher> holder = uhandler.core.openNewSearcher(true, true);
|
RefCounted<SolrIndexSearcher> holder = uhandler.core.openNewSearcher(true, true);
|
||||||
holder.decref();
|
holder.decref();
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, "Error opening realtime searcher for deleteByQuery", e);
|
SolrException.log(log, "Error opening realtime searcher for deleteByQuery", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -512,7 +512,7 @@ public class UpdateLog implements PluginInfoInitialized {
|
||||||
try {
|
try {
|
||||||
RefCounted<SolrIndexSearcher> holder = uhandler.core.openNewSearcher(true, true);
|
RefCounted<SolrIndexSearcher> holder = uhandler.core.openNewSearcher(true, true);
|
||||||
holder.decref();
|
holder.decref();
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, "Error opening realtime searcher for deleteByQuery", e);
|
SolrException.log(log, "Error opening realtime searcher for deleteByQuery", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -859,7 +859,7 @@ public class UpdateLog implements PluginInfoInitialized {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
try {
|
try {
|
||||||
ExecutorUtil.shutdownNowAndAwaitTermination(recoveryExecutor);
|
ExecutorUtil.shutdownNowAndAwaitTermination(recoveryExecutor);
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, e);
|
SolrException.log(log, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1222,7 +1222,7 @@ public class UpdateLog implements PluginInfoInitialized {
|
||||||
recoveryInfo.errors++;
|
recoveryInfo.errors++;
|
||||||
SolrException.log(log, e);
|
SolrException.log(log, e);
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
recoveryInfo.errors++;
|
recoveryInfo.errors++;
|
||||||
SolrException.log(log, e);
|
SolrException.log(log, e);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -1295,7 +1295,7 @@ public class UpdateLog implements PluginInfoInitialized {
|
||||||
SolrException.log(log,e);
|
SolrException.log(log,e);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
SolrException.log(log,e);
|
SolrException.log(log,e);
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log,e);
|
SolrException.log(log,e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1381,7 +1381,7 @@ public class UpdateLog implements PluginInfoInitialized {
|
||||||
recoveryInfo.errors++;
|
recoveryInfo.errors++;
|
||||||
loglog.warn("REYPLAY_ERR: IOException reading log", ex);
|
loglog.warn("REYPLAY_ERR: IOException reading log", ex);
|
||||||
// could be caused by an incomplete flush if recovering from log
|
// could be caused by an incomplete flush if recovering from log
|
||||||
} catch (Throwable ex) {
|
} catch (Exception ex) {
|
||||||
recoveryInfo.errors++;
|
recoveryInfo.errors++;
|
||||||
loglog.warn("REPLAY_ERR: Exception replaying log", ex);
|
loglog.warn("REPLAY_ERR: Exception replaying log", ex);
|
||||||
// something wrong with the request?
|
// something wrong with the request?
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class UpdateShardHandler {
|
||||||
public void close() {
|
public void close() {
|
||||||
try {
|
try {
|
||||||
ExecutorUtil.shutdownAndAwaitTermination(updateExecutor);
|
ExecutorUtil.shutdownAndAwaitTermination(updateExecutor);
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, e);
|
SolrException.log(log, e);
|
||||||
} finally {
|
} finally {
|
||||||
clientConnectionManager.shutdown();
|
clientConnectionManager.shutdown();
|
||||||
|
|
|
@ -184,23 +184,23 @@ public class ChaosMonkeyShardSplitTest extends ShardSplitTest {
|
||||||
Thread.sleep(800);
|
Thread.sleep(800);
|
||||||
overseerClient.close();
|
overseerClient.close();
|
||||||
overseerClient = electNewOverseer(zkAddress);
|
overseerClient = electNewOverseer(zkAddress);
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Thread.sleep(100);
|
Thread.sleep(100);
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Throwable t) {
|
} catch (Exception t) {
|
||||||
// ignore
|
// ignore
|
||||||
} finally {
|
} finally {
|
||||||
if (overseerClient != null) {
|
if (overseerClient != null) {
|
||||||
try {
|
try {
|
||||||
overseerClient.close();
|
overseerClient.close();
|
||||||
} catch (Throwable t) {
|
} catch (Exception t) {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -250,6 +250,9 @@ public class ConcurrentUpdateSolrServer extends SolrServer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
if (e instanceof OutOfMemoryError) {
|
||||||
|
throw (OutOfMemoryError) e;
|
||||||
|
}
|
||||||
handleError(e);
|
handleError(e);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
||||||
|
|
|
@ -510,9 +510,12 @@ public class HttpSolrServer extends SolrServer {
|
||||||
if (respBody != null && shouldClose) {
|
if (respBody != null && shouldClose) {
|
||||||
try {
|
try {
|
||||||
respBody.close();
|
respBody.close();
|
||||||
} catch (Throwable t) {} // ignore
|
} catch (IOException e) {
|
||||||
if (!success) {
|
log.error("", e);
|
||||||
method.abort();
|
} finally {
|
||||||
|
if (!success) {
|
||||||
|
method.abort();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,7 +146,7 @@ public class ConnectionManager implements Watcher {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
// we must have been asked to stop
|
// we must have been asked to stop
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
} catch (Throwable t) {
|
} catch (Exception t) {
|
||||||
closeKeeper(keeper);
|
closeKeeper(keeper);
|
||||||
throw new RuntimeException(t);
|
throw new RuntimeException(t);
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,7 @@ public class SolrZkClient {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
connManager.close();
|
connManager.close();
|
||||||
if (keeper != null) {
|
if (keeper != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -137,7 +137,7 @@ public class SolrZkClient {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
connManager.waitForConnected(clientConnectTimeout);
|
connManager.waitForConnected(clientConnectTimeout);
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
connManager.close();
|
connManager.close();
|
||||||
try {
|
try {
|
||||||
keeper.close();
|
keeper.close();
|
||||||
|
|
|
@ -43,8 +43,8 @@ public abstract class ZkClientConnectionStrategy {
|
||||||
for (DisconnectedListener listener : disconnectedListeners) {
|
for (DisconnectedListener listener : disconnectedListeners) {
|
||||||
try {
|
try {
|
||||||
listener.disconnected();
|
listener.disconnected();
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, "", t);
|
SolrException.log(log, "", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,8 +53,8 @@ public abstract class ZkClientConnectionStrategy {
|
||||||
for (ConnectedListener listener : connectedListeners) {
|
for (ConnectedListener listener : connectedListeners) {
|
||||||
try {
|
try {
|
||||||
listener.connected();
|
listener.connected();
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
SolrException.log(log, "", t);
|
SolrException.log(log, "", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue