use of org.apache.cassandra.exceptions.UnrecoverableIllegalStateException in project cassandra by apache.
the class JVMStabilityInspector method inspectThrowable.
public static void inspectThrowable(Throwable t, Consumer<Throwable> fn) throws OutOfMemoryError {
boolean isUnstable = false;
if (t instanceof OutOfMemoryError) {
if (Boolean.getBoolean("cassandra.printHeapHistogramOnOutOfMemoryError")) {
// time span.
synchronized (lock) {
if (printingHeapHistogram)
return;
printingHeapHistogram = true;
}
HeapUtils.logHeapHistogram();
}
logger.error("OutOfMemory error letting the JVM handle the error:", t);
StorageService.instance.removeShutdownHook();
forceHeapSpaceOomMaybe((OutOfMemoryError) t);
// the JVM behavior in case of OOM (CASSANDRA-13006).
throw (OutOfMemoryError) t;
} else if (t instanceof UnrecoverableIllegalStateException) {
isUnstable = true;
}
if (t instanceof InterruptedException)
throw new UncheckedInterruptedException((InterruptedException) t);
if (DatabaseDescriptor.getDiskFailurePolicy() == Config.DiskFailurePolicy.die)
if (t instanceof FSError || t instanceof CorruptSSTableException)
isUnstable = true;
// Check for file handle exhaustion
if (t instanceof FileNotFoundException || t instanceof FileSystemException || t instanceof SocketException)
if (t.getMessage() != null && t.getMessage().contains("Too many open files"))
isUnstable = true;
if (isUnstable) {
if (!StorageService.instance.isDaemonSetupCompleted())
FileUtils.handleStartupFSError(t);
killer.killCurrentJVM(t);
}
try {
fn.accept(t);
} catch (Exception | Error e) {
logger.warn("Unexpected error while handling unexpected error", e);
}
if (t.getCause() != null)
inspectThrowable(t.getCause(), fn);
}
Aggregations