[NO ISSUE] Don't log interrupts as WARNings
Change-Id: I0e847b8197fa12f1ce235dde404df24196939a83
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2855
Reviewed-by: abdullah alamoudi <bamousaa@gmail.com>
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/CleanupUtils.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/CleanupUtils.java
index ea86298..6e6d342 100644
--- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/CleanupUtils.java
+++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/CleanupUtils.java
@@ -38,7 +38,8 @@
destroyable.destroy();
} catch (Throwable th) { // NOSONAR. Had to be done to satisfy contracts
try {
- LOGGER.log(Level.WARN, "Failure destroying a destroyable resource", th);
+ LOGGER.log(ExceptionUtils.causedByInterrupt(th) ? Level.DEBUG : Level.WARN,
+ "Failure destroying a destroyable resource", th);
} catch (Throwable ignore) { // NOSONAR: Ignore catching Throwable
// NOSONAR Ignore logging failure
}
@@ -65,8 +66,8 @@
writer.close();
} catch (Throwable th) { // NOSONAR Will be suppressed
try {
- LOGGER.log(Level.WARN, "Failure closing a closeable resource of class {}",
- writer.getClass().getSimpleName(), th);
+ LOGGER.log(ExceptionUtils.causedByInterrupt(th) ? Level.DEBUG : Level.WARN,
+ "Failure closing a closeable resource of class {}", writer.getClass().getSimpleName(), th);
} catch (Throwable loggingFailure) { // NOSONAR: Ignore catching Throwable
// NOSONAR: Ignore logging failure
}
@@ -90,7 +91,8 @@
writer.fail();
} catch (Throwable th) { // NOSONAR Will be suppressed
try {
- LOGGER.log(Level.WARN, "Failure failing " + writer.getClass().getSimpleName(), th);
+ LOGGER.log(ExceptionUtils.causedByInterrupt(th) ? Level.DEBUG : Level.WARN,
+ "Failure failing " + writer.getClass().getSimpleName(), th);
} catch (Throwable loggingFailure) { // NOSONAR: Ignore catching Throwable
// NOSONAR ignore logging failure
}
@@ -114,7 +116,8 @@
closable.close();
} catch (Throwable th) { // NOSONAR Will be suppressed
try {
- LOGGER.log(Level.WARN, "Failure closing a closeable resource", th);
+ LOGGER.log(ExceptionUtils.causedByInterrupt(th) ? Level.DEBUG : Level.WARN,
+ "Failure closing a closeable resource", th);
} catch (Throwable loggingFailure) { // NOSONAR: Ignore catching Throwable
// NOSONAR ignore logging failure
}
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/ExceptionUtils.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/ExceptionUtils.java
index bba0de7..9c0797e 100644
--- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/ExceptionUtils.java
+++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/ExceptionUtils.java
@@ -130,4 +130,7 @@
return current;
}
+ public static boolean causedByInterrupt(Throwable th) {
+ return getRootCause(th) instanceof InterruptedException;
+ }
}
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/result/ResultDirectoryService.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/result/ResultDirectoryService.java
index a65ce4c..0e7f6ee 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/result/ResultDirectoryService.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/result/ResultDirectoryService.java
@@ -40,6 +40,7 @@
import org.apache.hyracks.api.job.JobId;
import org.apache.hyracks.api.job.JobSpecification;
import org.apache.hyracks.api.job.JobStatus;
+import org.apache.hyracks.api.util.ExceptionUtils;
import org.apache.hyracks.control.common.result.AbstractResultManager;
import org.apache.hyracks.control.common.result.ResultStateSweeper;
import org.apache.hyracks.control.common.work.IResultCallback;
@@ -146,19 +147,20 @@
@Override
public synchronized void reportJobFailure(JobId jobId, List<Exception> exceptions) {
- LOGGER.log(Level.INFO, "job " + jobId + " failed and is being reported to " + getClass().getSimpleName(),
- exceptions.get(0));
+ Exception ex = exceptions.isEmpty() ? null : exceptions.get(0);
+ Level logLevel = ExceptionUtils.causedByInterrupt(ex) ? Level.DEBUG : Level.INFO;
+ LOGGER.log(logLevel, "job " + jobId + " failed and is being reported to " + getClass().getSimpleName(), ex);
ResultJobRecord rjr = getResultJobRecord(jobId);
- LOGGER.log(Level.INFO, "Result job record is " + rjr);
+ LOGGER.log(logLevel, "Result job record is " + rjr);
if (rjr != null) {
- LOGGER.log(Level.INFO, "Setting exceptions in Result job record");
+ LOGGER.log(logLevel, "Setting exceptions in Result job record");
rjr.fail(exceptions);
}
final JobResultInfo jobResultInfo = jobResultLocations.get(jobId);
- LOGGER.log(Level.INFO, "Job result info is " + jobResultInfo);
+ LOGGER.log(logLevel, "Job result info is " + jobResultInfo);
if (jobResultInfo != null) {
- LOGGER.log(Level.INFO, "Setting exceptions in Job result info");
- jobResultInfo.setException(exceptions.isEmpty() ? null : exceptions.get(0));
+ LOGGER.log(logLevel, "Setting exceptions in Job result info");
+ jobResultInfo.setException(ex);
}
notifyAll();
}
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/TaskFailureWork.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/TaskFailureWork.java
index 8c86aff..833066e 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/TaskFailureWork.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/TaskFailureWork.java
@@ -22,6 +22,7 @@
import org.apache.hyracks.api.dataflow.TaskAttemptId;
import org.apache.hyracks.api.job.JobId;
+import org.apache.hyracks.api.util.ExceptionUtils;
import org.apache.hyracks.control.cc.ClusterControllerService;
import org.apache.hyracks.control.cc.job.IJobManager;
import org.apache.hyracks.control.cc.job.JobRun;
@@ -42,7 +43,9 @@
@Override
protected void performEvent(TaskAttempt ta) {
- LOGGER.log(Level.WARN, "Executing task failure work for " + this, exceptions.get(0));
+ Exception ex = exceptions.get(0);
+ LOGGER.log(ExceptionUtils.causedByInterrupt(ex) ? Level.DEBUG : Level.WARN,
+ "Executing task failure work for " + this, ex);
IJobManager jobManager = ccs.getJobManager();
JobRun run = jobManager.get(jobId);
if (run == null) {
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/Task.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/Task.java
index f6531d7..252fe97 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/Task.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/Task.java
@@ -355,10 +355,11 @@
if (!exceptions.isEmpty()) {
if (LOGGER.isWarnEnabled()) {
for (int i = 0; i < exceptions.size(); i++) {
- LOGGER.log(Level.WARN,
- "Task " + taskAttemptId + " failed with exception"
+ Exception e = exceptions.get(i);
+ LOGGER.log(ExceptionUtils.causedByInterrupt(e) ? Level.DEBUG : Level.WARN,
+ "Task failed with exception"
+ (exceptions.size() > 1 ? "s (" + (i + 1) + "/" + exceptions.size() + ")" : ""),
- exceptions.get(i));
+ e);
}
}
ExceptionUtils.setNodeIds(exceptions, ncs.getId());
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/partitions/MaterializingPipelinedPartition.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/partitions/MaterializingPipelinedPartition.java
index 37f33a9..96cbc35 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/partitions/MaterializingPipelinedPartition.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/partitions/MaterializingPipelinedPartition.java
@@ -30,6 +30,7 @@
import org.apache.hyracks.api.io.IIOManager;
import org.apache.hyracks.api.partitions.IPartition;
import org.apache.hyracks.api.partitions.PartitionId;
+import org.apache.hyracks.api.util.ExceptionUtils;
import org.apache.hyracks.control.common.job.PartitionState;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
@@ -89,7 +90,7 @@
Thread thread = Thread.currentThread();
setDataConsumerThread(thread); // Sets the data consumer thread to the current thread.
try {
- thread.setName(MaterializingPipelinedPartition.class.getName() + " " + pid);
+ thread.setName(MaterializingPipelinedPartition.this.getClass().getSimpleName() + " " + pid);
FileReference fRefCopy;
synchronized (MaterializingPipelinedPartition.this) {
while (fRef == null && !eos && !failed) {
@@ -164,7 +165,8 @@
}
}
} catch (Exception e) {
- LOGGER.warn("Failure writing to a frame", e);
+ LOGGER.log(ExceptionUtils.causedByInterrupt(e) ? Level.DEBUG : Level.WARN,
+ "Failure writing to a frame", e);
} finally {
setDataConsumerThread(null); // Sets back the data consumer thread to null.
}
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/NotifyTaskFailureWork.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/NotifyTaskFailureWork.java
index 7dbb3c2..b0c60aa 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/NotifyTaskFailureWork.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/NotifyTaskFailureWork.java
@@ -23,6 +23,7 @@
import org.apache.hyracks.api.dataflow.TaskAttemptId;
import org.apache.hyracks.api.job.JobId;
import org.apache.hyracks.api.result.IResultPartitionManager;
+import org.apache.hyracks.api.util.ExceptionUtils;
import org.apache.hyracks.control.common.work.AbstractWork;
import org.apache.hyracks.control.nc.NodeControllerService;
import org.apache.hyracks.control.nc.Task;
@@ -49,8 +50,9 @@
@Override
public void run() {
- LOGGER.log(Level.WARN, ncs.getId() + " is sending a notification to cc that task " + taskId + " has failed",
- exceptions.get(0));
+ Exception ex = exceptions.get(0);
+ LOGGER.log(ExceptionUtils.causedByInterrupt(ex) ? Level.DEBUG : Level.WARN, "task " + taskId + " has failed",
+ ex);
try {
IResultPartitionManager resultPartitionManager = ncs.getResultPartitionManager();
if (resultPartitionManager != null) {
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/BufferCache.java b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/BufferCache.java
index 5d8a701..f8b9a57 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/BufferCache.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/BufferCache.java
@@ -46,6 +46,7 @@
import org.apache.hyracks.api.io.IIOManager;
import org.apache.hyracks.api.lifecycle.ILifeCycleComponent;
import org.apache.hyracks.api.replication.IIOReplicationManager;
+import org.apache.hyracks.api.util.ExceptionUtils;
import org.apache.hyracks.api.util.IoUtil;
import org.apache.hyracks.storage.common.file.BufferedFileHandle;
import org.apache.hyracks.storage.common.file.IFileMapManager;
@@ -193,7 +194,8 @@
tryRead(cPage);
cPage.valid = true;
} catch (Exception e) {
- LOGGER.log(Level.WARN, "Failure while trying to read a page from disk", e);
+ LOGGER.log(ExceptionUtils.causedByInterrupt(e) ? Level.DEBUG : Level.WARN,
+ "Failure while trying to read a page from disk", e);
throw e;
} finally {
if (!cPage.valid) {