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