You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by se...@apache.org on 2018/03/08 16:51:00 UTC

[1/5] flink git commit: [FLINK-8856] [TaskManager] Move all cancellation interrupt calls to TaskCanceller thread

Repository: flink
Updated Branches:
  refs/heads/master 236ceb58f -> 4dcc492bd


[FLINK-8856] [TaskManager] Move all cancellation interrupt calls to TaskCanceller thread

This cleans up the code and guards against a JVM bug where 'interrupt()' calls
block/deadlock if the thread is engaged in certain I/O operations.

In addition, this makes sure that the process really goes away when the cancellation
timeout expires, rather than relying on the TaskManager to be able to properly handle
the fatal error notification.


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/1e123762
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/1e123762
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/1e123762

Branch: refs/heads/master
Commit: 1e1237628a6bf05cdcdde6f9f3a236d961f05b5d
Parents: 53168d0
Author: Stephan Ewen <se...@apache.org>
Authored: Tue Mar 6 15:18:33 2018 +0100
Committer: Stephan Ewen <se...@apache.org>
Committed: Thu Mar 8 16:18:04 2018 +0100

----------------------------------------------------------------------
 .../apache/flink/runtime/taskmanager/Task.java  | 280 ++++++++++++-------
 1 file changed, 177 insertions(+), 103 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/1e123762/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java b/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java
index 00fbdfe..ccb850e 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java
@@ -67,6 +67,7 @@ import org.apache.flink.runtime.metrics.groups.TaskMetricGroup;
 import org.apache.flink.runtime.query.TaskKvStateRegistry;
 import org.apache.flink.runtime.state.CheckpointListener;
 import org.apache.flink.runtime.state.TaskStateManager;
+import org.apache.flink.runtime.util.FatalExitExceptionHandler;
 import org.apache.flink.util.ExceptionUtils;
 import org.apache.flink.util.FlinkException;
 import org.apache.flink.util.Preconditions;
@@ -77,7 +78,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 
 import java.io.IOException;
 import java.lang.reflect.Constructor;
@@ -94,11 +94,11 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 import java.util.concurrent.RejectedExecutionException;
-import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
 
+import static org.apache.flink.util.Preconditions.checkArgument;
 import static org.apache.flink.util.Preconditions.checkNotNull;
 import static org.apache.flink.util.Preconditions.checkState;
 
@@ -1048,15 +1048,51 @@ public class Task implements Runnable, TaskActions, CheckpointListener {
 								invokable,
 								executingThread,
 								taskNameWithSubtask,
-								taskCancellationInterval,
-								taskCancellationTimeout,
-								taskManagerActions,
 								producedPartitions,
 								inputGates);
-						Thread cancelThread = new Thread(executingThread.getThreadGroup(), canceler,
+
+						Thread cancelThread = new Thread(
+								executingThread.getThreadGroup(),
+								canceler,
 								String.format("Canceler for %s (%s).", taskNameWithSubtask, executionId));
 						cancelThread.setDaemon(true);
+						cancelThread.setUncaughtExceptionHandler(FatalExitExceptionHandler.INSTANCE);
 						cancelThread.start();
+
+						// the periodic interrupting thread - a different thread than the canceller, in case
+						// the application code does blocking stuff in its cancellation paths.
+						Runnable interrupter = new TaskInterrupter(
+								LOG,
+								executingThread,
+								taskNameWithSubtask,
+								taskCancellationInterval);
+
+						Thread interruptingThread = new Thread(
+								executingThread.getThreadGroup(),
+								interrupter,
+								String.format("Canceler/Interrupts for %s (%s).", taskNameWithSubtask, executionId));
+						interruptingThread.setDaemon(true);
+						interruptingThread.setUncaughtExceptionHandler(FatalExitExceptionHandler.INSTANCE);
+						interruptingThread.start();
+
+						// if a cancellation timeout is set, the watchdog thread kills the process
+						// if graceful cancellation does not succeed
+						if (taskCancellationTimeout > 0) {
+							Runnable cancelWatchdog = new TaskCancelerWatchDog(
+									executingThread,
+									taskManagerActions,
+									taskCancellationTimeout,
+									LOG);
+
+							Thread watchDogThread = new Thread(
+									executingThread.getThreadGroup(),
+									cancelWatchdog,
+									String.format("Cancellation Watchdog for %s (%s).",
+											taskNameWithSubtask, executionId));
+							watchDogThread.setDaemon(true);
+							watchDogThread.setUncaughtExceptionHandler(FatalExitExceptionHandler.INSTANCE);
+							watchDogThread.start();
+						}
 					}
 					return;
 				}
@@ -1408,12 +1444,28 @@ public class Task implements Runnable, TaskActions, CheckpointListener {
 	}
 
 	// ------------------------------------------------------------------------
-	//  TaskCanceler
+	//  Task cancellation
+	//
+	//  The task cancellation uses in total three threads, as a safety net
+	//  against various forms of user- and JVM bugs.
+	//
+	//    - The first thread calls 'cancel()' on the invokable and closes
+	//      the input and output connections, for fast thread termination
+	//    - The second thread periodically interrupts the invokable in order
+	//      to pull the thread out of blocking wait and I/O operations
+	//    - The third thread (watchdog thread) waits until the cancellation
+	//      timeout and then performs a hard cancel (kill process, or let
+	//      the TaskManager know)
+	//
+	//  Previously, thread two and three were in one thread, but we needed
+	//  to separate this to make sure the watchdog thread does not call
+	//  'interrupt()'. This is a workaround for the following JVM bug
+	//   https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8138622
 	// ------------------------------------------------------------------------
 
 	/**
-	 * This runner calls cancel() on the invokable and periodically interrupts the
-	 * thread until it has terminated.
+	 * This runner calls cancel() on the invokable, closes input-/output resources,
+	 * and initially interrupts the task thread.
 	 */
 	private static class TaskCanceler implements Runnable {
 
@@ -1424,27 +1476,11 @@ public class Task implements Runnable, TaskActions, CheckpointListener {
 		private final ResultPartition[] producedPartitions;
 		private final SingleInputGate[] inputGates;
 
-		/** Interrupt interval. */
-		private final long interruptInterval;
-
-		/** Timeout after which a fatal error notification happens. */
-		private final long interruptTimeout;
-
-		/** TaskManager to notify about a timeout */
-		private final TaskManagerActions taskManager;
-
-		/** Watch Dog thread */
-		@Nullable
-		private final Thread watchDogThread;
-
 		public TaskCanceler(
 				Logger logger,
 				AbstractInvokable invokable,
 				Thread executer,
 				String taskName,
-				long cancellationInterval,
-				long cancellationTimeout,
-				TaskManagerActions taskManager,
 				ResultPartition[] producedPartitions,
 				SingleInputGate[] inputGates) {
 
@@ -1452,39 +1488,19 @@ public class Task implements Runnable, TaskActions, CheckpointListener {
 			this.invokable = invokable;
 			this.executer = executer;
 			this.taskName = taskName;
-			this.interruptInterval = cancellationInterval;
-			this.interruptTimeout = cancellationTimeout;
-			this.taskManager = taskManager;
 			this.producedPartitions = producedPartitions;
 			this.inputGates = inputGates;
-
-			if (cancellationTimeout > 0) {
-				// The watch dog repeatedly interrupts the executor until
-				// the cancellation timeout kicks in (at which point the
-				// task manager is notified about a fatal error) or the
-				// executor has terminated.
-				this.watchDogThread = new Thread(
-						executer.getThreadGroup(),
-						new TaskCancelerWatchDog(),
-						"WatchDog for " + taskName + " cancellation");
-				this.watchDogThread.setDaemon(true);
-			} else {
-				this.watchDogThread = null;
-			}
 		}
 
 		@Override
 		public void run() {
 			try {
-				if (watchDogThread != null) {
-					watchDogThread.start();
-				}
-
 				// the user-defined cancel method may throw errors.
 				// we need do continue despite that
 				try {
 					invokable.cancel();
 				} catch (Throwable t) {
+					ExceptionUtils.rethrowIfFatalError(t);
 					logger.error("Error while canceling the task {}.", taskName, t);
 				}
 
@@ -1499,6 +1515,7 @@ public class Task implements Runnable, TaskActions, CheckpointListener {
 					try {
 						partition.destroyBufferPool();
 					} catch (Throwable t) {
+						ExceptionUtils.rethrowIfFatalError(t);
 						LOG.error("Failed to release result partition buffer pool for task {}.", taskName, t);
 					}
 				}
@@ -1507,89 +1524,146 @@ public class Task implements Runnable, TaskActions, CheckpointListener {
 					try {
 						inputGate.releaseAllResources();
 					} catch (Throwable t) {
+						ExceptionUtils.rethrowIfFatalError(t);
 						LOG.error("Failed to release input gate for task {}.", taskName, t);
 					}
 				}
 
-				// interrupt the running thread initially
+				// send the initial interruption signal
 				executer.interrupt();
-				try {
-					executer.join(interruptInterval);
-				}
-				catch (InterruptedException e) {
-					// we can ignore this
-				}
-
-				if (watchDogThread != null) {
-					watchDogThread.interrupt();
-					watchDogThread.join();
-				}
-			} catch (Throwable t) {
+			}
+			catch (Throwable t) {
+				ExceptionUtils.rethrowIfFatalError(t);
 				logger.error("Error in the task canceler for task {}.", taskName, t);
 			}
 		}
+	}
+
+	/**
+	 * This thread sends the delayed, periodic interrupt calls to the executing thread.
+	 */
+	private static final class TaskInterrupter implements Runnable {
 
-		/**
-		 * Watchdog for the cancellation. If the task is stuck in cancellation,
-		 * we notify the task manager about a fatal error.
-		 */
-		private class TaskCancelerWatchDog implements Runnable {
+		/** The logger to report on the fatal condition. */
+		private final Logger log;
 
-			@Override
-			public void run() {
-				long intervalNanos = TimeUnit.NANOSECONDS.convert(interruptInterval, TimeUnit.MILLISECONDS);
-				long timeoutNanos = TimeUnit.NANOSECONDS.convert(interruptTimeout, TimeUnit.MILLISECONDS);
-				long deadline = System.nanoTime() + timeoutNanos;
+		/** The executing task thread that we wait for to terminate. */
+		private final Thread executerThread;
 
-				try {
-					// Initial wait before interrupting periodically
-					Thread.sleep(interruptInterval);
-				} catch (InterruptedException ignored) {
-				}
+		/** The name of the task, for logging purposes. */
+		private final String taskName;
 
-				// It is possible that the user code does not react to the task canceller.
-				// for that reason, we spawn this separate thread that repeatedly interrupts
-				// the user code until it exits. If the user code does not exit within
-				// the timeout, we notify the job manager about a fatal error.
-				while (executer.isAlive()) {
-					long now = System.nanoTime();
+		/** The interval in which we interrupt. */
+		private final long interruptIntervalMillis;
+
+		TaskInterrupter(
+				Logger log,
+				Thread executerThread,
+				String taskName,
+				long interruptIntervalMillis) {
+
+			this.log = log;
+			this.executerThread = executerThread;
+			this.taskName = taskName;
+			this.interruptIntervalMillis = interruptIntervalMillis;
+		}
 
+		@Override
+		public void run() {
+			try {
+				// we initially wait for one interval
+				// in most cases, the threads go away immediately (by the cancellation thread)
+				// and we need not actually do anything
+				executerThread.join(interruptIntervalMillis);
+
+				// log stack trace where the executing thread is stuck and
+				// interrupt the running thread periodically while it is still alive
+				while (executerThread.isAlive()) {
 					// build the stack trace of where the thread is stuck, for the log
+					StackTraceElement[] stack = executerThread.getStackTrace();
 					StringBuilder bld = new StringBuilder();
-					StackTraceElement[] stack = executer.getStackTrace();
 					for (StackTraceElement e : stack) {
 						bld.append(e).append('\n');
 					}
 
-					if (now >= deadline) {
-						long duration = TimeUnit.SECONDS.convert(interruptInterval, TimeUnit.MILLISECONDS);
-						String msg = String.format("Task '%s' did not react to cancelling signal in " +
-										"the last %d seconds, but is stuck in method:\n %s",
-								taskName,
-								duration,
-								bld.toString());
+					log.warn("Task '{}' did not react to cancelling signal for {} seconds, but is stuck in method:\n {}",
+							taskName, (interruptIntervalMillis / 1000), bld);
 
-						logger.info("Notifying TaskManager about fatal error. {}.", msg);
+					executerThread.interrupt();
+					try {
+						executerThread.join(interruptIntervalMillis);
+					}
+					catch (InterruptedException e) {
+						// we ignore this and fall through the loop
+					}
+				}
+			} catch (Throwable t) {
+				ExceptionUtils.rethrowIfFatalError(t);
+				log.error("Error in the task canceler for task {}.", taskName, t);
+			}
+		}
+	}
 
-						taskManager.notifyFatalError(msg, null);
+	/**
+	 * Watchdog for the cancellation.
+	 * If the task thread does not go away gracefully within a certain time, we
+	 * trigger a hard cancel action (notify TaskManager of fatal error, which in
+	 * turn kills the process).
+	 */
+	private static class TaskCancelerWatchDog implements Runnable {
 
-						return; // done, don't forget to leave the loop
-					} else {
-						logger.warn("Task '{}' did not react to cancelling signal, but is stuck in method:\n {}",
-								taskName, bld.toString());
+		/** The logger to report on the fatal condition. */
+		private final Logger log;
 
-						executer.interrupt();
-						try {
-							long timeLeftNanos = Math.min(intervalNanos, deadline - now);
-							long timeLeftMillis = TimeUnit.MILLISECONDS.convert(timeLeftNanos, TimeUnit.NANOSECONDS);
+		/** The executing task thread that we wait for to terminate. */
+		private final Thread executerThread;
 
-							if (timeLeftMillis > 0) {
-								executer.join(timeLeftMillis);
-							}
-						} catch (InterruptedException ignored) {
-						}
+		/** The TaskManager to notify if cancellation does not happen in time. */
+		private final TaskManagerActions taskManager;
+
+		/** The timeout for cancellation. */
+		private final long timeoutMillis;
+
+		TaskCancelerWatchDog(
+				Thread executerThread,
+				TaskManagerActions taskManager,
+				long timeoutMillis,
+				Logger log) {
+
+			checkArgument(timeoutMillis > 0);
+
+			this.log = log;
+			this.executerThread = executerThread;
+			this.taskManager = taskManager;
+			this.timeoutMillis = timeoutMillis;
+		}
+
+		@Override
+		public void run() {
+			try {
+				final long hardKillDeadline = System.nanoTime() + timeoutMillis * 1_000_000;
+
+				long millisLeft;
+				while (executerThread.isAlive()
+						&& (millisLeft = (hardKillDeadline - System.nanoTime()) / 1_000_000) > 0) {
+
+					try {
+						executerThread.join(millisLeft);
+					}
+					catch (InterruptedException ignored) {
+						// we don't react to interrupted exceptions, simply fall through the loop
 					}
 				}
+
+				if (executerThread.isAlive()) {
+					String msg = "Task did not exit gracefully within " + (timeoutMillis / 1000) + " + seconds.";
+					log.error(msg);
+					taskManager.notifyFatalError(msg, null);
+				}
+			}
+			catch (Throwable t) {
+				ExceptionUtils.rethrowIfFatalError(t);
+				log.error("Error in Task Cancellation Watch Dog", t);
 			}
 		}
 	}


[4/5] flink git commit: [FLINK-8885] [TaskManager] DispatcherThreadFactory registers a fatal error exception handler

Posted by se...@apache.org.
[FLINK-8885] [TaskManager] DispatcherThreadFactory registers a fatal error exception handler

In case dispatcher threads let an exception bubble out (do not handle the exception), the
exception handler terminates the process, to ensure we don't leave broken processes.


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/dd82f872
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/dd82f872
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/dd82f872

Branch: refs/heads/master
Commit: dd82f8720fa5aeb3a29c858cd7c032ff25f935ae
Parents: 1d77b66
Author: Stephan Ewen <se...@apache.org>
Authored: Tue Mar 6 17:14:54 2018 +0100
Committer: Stephan Ewen <se...@apache.org>
Committed: Thu Mar 8 16:22:08 2018 +0100

----------------------------------------------------------------------
 .../runtime/taskmanager/DispatcherThreadFactory.java      | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/dd82f872/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/DispatcherThreadFactory.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/DispatcherThreadFactory.java b/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/DispatcherThreadFactory.java
index 543b159..9cec524 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/DispatcherThreadFactory.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/DispatcherThreadFactory.java
@@ -18,6 +18,8 @@
 
 package org.apache.flink.runtime.taskmanager;
 
+import org.apache.flink.runtime.util.FatalExitExceptionHandler;
+
 import javax.annotation.Nullable;
 
 import java.util.concurrent.ThreadFactory;
@@ -27,13 +29,14 @@ import java.util.concurrent.ThreadFactory;
  * thread group, and set them to daemon mode.
  */
 public class DispatcherThreadFactory implements ThreadFactory {
-	
+
 	private final ThreadGroup group;
-	
+
 	private final String threadName;
 
+	@Nullable
 	private final ClassLoader classLoader;
-	
+
 	/**
 	 * Creates a new thread factory.
 	 *
@@ -67,6 +70,7 @@ public class DispatcherThreadFactory implements ThreadFactory {
 			t.setContextClassLoader(classLoader);
 		}
 		t.setDaemon(true);
+		t.setUncaughtExceptionHandler(FatalExitExceptionHandler.INSTANCE);
 		return t;
 	}
 }


[5/5] flink git commit: [hotfix] [runtime] Harden FatalExitExceptionHandler

Posted by se...@apache.org.
[hotfix] [runtime] Harden FatalExitExceptionHandler

In case the logging framework throws an exception when handling the exception,
we still kill the process, as intended.


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/4dcc492b
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/4dcc492b
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/4dcc492b

Branch: refs/heads/master
Commit: 4dcc492bdbd9eb986e0b367c27f53fda7238eeb7
Parents: dd82f87
Author: Stephan Ewen <se...@apache.org>
Authored: Tue Mar 6 17:18:38 2018 +0100
Committer: Stephan Ewen <se...@apache.org>
Committed: Thu Mar 8 16:22:50 2018 +0100

----------------------------------------------------------------------
 .../flink/runtime/util/FatalExitExceptionHandler.java    | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/4dcc492b/flink-runtime/src/main/java/org/apache/flink/runtime/util/FatalExitExceptionHandler.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/util/FatalExitExceptionHandler.java b/flink-runtime/src/main/java/org/apache/flink/runtime/util/FatalExitExceptionHandler.java
index c57b75a..e162a58 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/util/FatalExitExceptionHandler.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/util/FatalExitExceptionHandler.java
@@ -34,9 +34,14 @@ public final class FatalExitExceptionHandler implements Thread.UncaughtException
 	public static final FatalExitExceptionHandler INSTANCE = new FatalExitExceptionHandler();
 
 	@Override
+	@SuppressWarnings("finally")
 	public void uncaughtException(Thread t, Throwable e) {
-		LOG.error("FATAL: Thread '" + t.getName() +
-			"' produced an uncaught exception. Stopping the process...", e);
-		System.exit(-17);
+		try {
+			LOG.error("FATAL: Thread '" + t.getName() +
+				"' produced an uncaught exception. Stopping the process...", e);
+		}
+		finally {
+			System.exit(-17);
+		}
 	}
 }


[2/5] flink git commit: [hotfix] [taskmanager] Fix checkstyle in Task and TaskTest

Posted by se...@apache.org.
[hotfix] [taskmanager] Fix checkstyle in Task and TaskTest


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/53168d00
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/53168d00
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/53168d00

Branch: refs/heads/master
Commit: 53168d00cf07f1b93d048f3fc849ce354fa8c7d4
Parents: 236ceb5
Author: Stephan Ewen <se...@apache.org>
Authored: Tue Mar 6 15:54:13 2018 +0100
Committer: Stephan Ewen <se...@apache.org>
Committed: Thu Mar 8 16:18:04 2018 +0100

----------------------------------------------------------------------
 .../apache/flink/runtime/taskmanager/Task.java  |  80 ++++++------
 .../flink/runtime/taskmanager/TaskTest.java     | 126 ++++++++++---------
 2 files changed, 106 insertions(+), 100 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/53168d00/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java b/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java
index 1ecb47a..00fbdfe 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java
@@ -127,10 +127,10 @@ public class Task implements Runnable, TaskActions, CheckpointListener {
 	/** The class logger. */
 	private static final Logger LOG = LoggerFactory.getLogger(Task.class);
 
-	/** The tread group that contains all task threads */
+	/** The tread group that contains all task threads. */
 	private static final ThreadGroup TASK_THREADS_GROUP = new ThreadGroup("Flink Task Threads");
 
-	/** For atomic state updates */
+	/** For atomic state updates. */
 	private static final AtomicReferenceFieldUpdater<Task, ExecutionState> STATE_UPDATER =
 			AtomicReferenceFieldUpdater.newUpdater(Task.class, ExecutionState.class, "executionState");
 
@@ -138,52 +138,52 @@ public class Task implements Runnable, TaskActions, CheckpointListener {
 	//  Constant fields that are part of the initial Task construction
 	// ------------------------------------------------------------------------
 
-	/** The job that the task belongs to */
+	/** The job that the task belongs to. */
 	private final JobID jobId;
 
-	/** The vertex in the JobGraph whose code the task executes */
+	/** The vertex in the JobGraph whose code the task executes. */
 	private final JobVertexID vertexId;
 
-	/** The execution attempt of the parallel subtask */
+	/** The execution attempt of the parallel subtask. */
 	private final ExecutionAttemptID executionId;
 
-	/** ID which identifies the slot in which the task is supposed to run */
+	/** ID which identifies the slot in which the task is supposed to run. */
 	private final AllocationID allocationId;
 
-	/** TaskInfo object for this task */
+	/** TaskInfo object for this task. */
 	private final TaskInfo taskInfo;
 
-	/** The name of the task, including subtask indexes */
+	/** The name of the task, including subtask indexes. */
 	private final String taskNameWithSubtask;
 
-	/** The job-wide configuration object */
+	/** The job-wide configuration object. */
 	private final Configuration jobConfiguration;
 
-	/** The task-specific configuration */
+	/** The task-specific configuration. */
 	private final Configuration taskConfiguration;
 
-	/** The jar files used by this task */
+	/** The jar files used by this task. */
 	private final Collection<PermanentBlobKey> requiredJarFiles;
 
-	/** The classpaths used by this task */
+	/** The classpaths used by this task. */
 	private final Collection<URL> requiredClasspaths;
 
-	/** The name of the class that holds the invokable code */
+	/** The name of the class that holds the invokable code. */
 	private final String nameOfInvokableClass;
 
-	/** Access to task manager configuration and host names*/
+	/** Access to task manager configuration and host names. */
 	private final TaskManagerRuntimeInfo taskManagerConfig;
 
-	/** The memory manager to be used by this task */
+	/** The memory manager to be used by this task. */
 	private final MemoryManager memoryManager;
 
-	/** The I/O manager to be used by this task */
+	/** The I/O manager to be used by this task. */
 	private final IOManager ioManager;
 
-	/** The BroadcastVariableManager to be used by this task */
+	/** The BroadcastVariableManager to be used by this task. */
 	private final BroadcastVariableManager broadcastVariableManager;
 
-	/** The manager for state of operators running in this task/slot */
+	/** The manager for state of operators running in this task/slot. */
 	private final TaskStateManager taskStateManager;
 
 	/** Serialized version of the job specific execution configuration (see {@link ExecutionConfig}). */
@@ -195,43 +195,43 @@ public class Task implements Runnable, TaskActions, CheckpointListener {
 
 	private final Map<IntermediateDataSetID, SingleInputGate> inputGatesById;
 
-	/** Connection to the task manager */
+	/** Connection to the task manager. */
 	private final TaskManagerActions taskManagerActions;
 
-	/** Input split provider for the task */
+	/** Input split provider for the task. */
 	private final InputSplitProvider inputSplitProvider;
 
-	/** Checkpoint notifier used to communicate with the CheckpointCoordinator */
+	/** Checkpoint notifier used to communicate with the CheckpointCoordinator. */
 	private final CheckpointResponder checkpointResponder;
 
-	/** All listener that want to be notified about changes in the task's execution state */
+	/** All listener that want to be notified about changes in the task's execution state. */
 	private final List<TaskExecutionStateListener> taskExecutionStateListeners;
 
-	/** The BLOB cache, from which the task can request BLOB files */
+	/** The BLOB cache, from which the task can request BLOB files. */
 	private final BlobCacheService blobService;
 
-	/** The library cache, from which the task can request its class loader */
+	/** The library cache, from which the task can request its class loader. */
 	private final LibraryCacheManager libraryCache;
 
-	/** The cache for user-defined files that the invokable requires */
+	/** The cache for user-defined files that the invokable requires. */
 	private final FileCache fileCache;
 
-	/** The gateway to the network stack, which handles inputs and produced results */
+	/** The gateway to the network stack, which handles inputs and produced results. */
 	private final NetworkEnvironment network;
 
-	/** The registry of this task which enables live reporting of accumulators */
+	/** The registry of this task which enables live reporting of accumulators. */
 	private final AccumulatorRegistry accumulatorRegistry;
 
-	/** The thread that executes the task */
+	/** The thread that executes the task. */
 	private final Thread executingThread;
 
-	/** Parent group for all metrics of this task */
+	/** Parent group for all metrics of this task. */
 	private final TaskMetricGroup metrics;
 
-	/** Partition producer state checker to request partition states from */
+	/** Partition producer state checker to request partition states from. */
 	private final PartitionProducerStateChecker partitionProducerStateChecker;
 
-	/** Executor to run future callbacks */
+	/** Executor to run future callbacks. */
 	private final Executor executor;
 
 	// ------------------------------------------------------------------------
@@ -240,19 +240,19 @@ public class Task implements Runnable, TaskActions, CheckpointListener {
 	//  proper happens-before semantics on parallel modification
 	// ------------------------------------------------------------------------
 
-	/** atomic flag that makes sure the invokable is canceled exactly once upon error */
+	/** atomic flag that makes sure the invokable is canceled exactly once upon error. */
 	private final AtomicBoolean invokableHasBeenCanceled;
 
-	/** The invokable of this task, if initialized */
+	/** The invokable of this task, if initialized. */
 	private volatile AbstractInvokable invokable;
 
-	/** The current execution state of the task */
+	/** The current execution state of the task. */
 	private volatile ExecutionState executionState = ExecutionState.CREATED;
 
-	/** The observed exception, in case the task execution failed */
+	/** The observed exception, in case the task execution failed. */
 	private volatile Throwable failureCause;
 
-	/** Serial executor for asynchronous calls (checkpoints, etc), lazily initialized */
+	/** Serial executor for asynchronous calls (checkpoints, etc), lazily initialized. */
 	private volatile ExecutorService asyncCallDispatcher;
 
 	/** Initialized from the Flink configuration. May also be set at the ExecutionConfig */
@@ -512,7 +512,7 @@ public class Task implements Runnable, TaskActions, CheckpointListener {
 	}
 
 	/**
-	 * The core work method that bootstraps the task and executes its code
+	 * The core work method that bootstraps the task and executes its code.
 	 */
 	@Override
 	public void run() {
@@ -556,7 +556,7 @@ public class Task implements Runnable, TaskActions, CheckpointListener {
 
 		// all resource acquisitions and registrations from here on
 		// need to be undone in the end
-		Map<String, Future<Path>> distributedCacheEntries = new HashMap<String, Future<Path>>();
+		Map<String, Future<Path>> distributedCacheEntries = new HashMap<>();
 		AbstractInvokable invokable = null;
 
 		try {
@@ -743,8 +743,8 @@ public class Task implements Runnable, TaskActions, CheckpointListener {
 			try {
 				// check if the exception is unrecoverable
 				if (ExceptionUtils.isJvmFatalError(t) ||
-					(t instanceof OutOfMemoryError && taskManagerConfig.shouldExitJvmOnOutOfMemoryError()))
-				{
+						(t instanceof OutOfMemoryError && taskManagerConfig.shouldExitJvmOnOutOfMemoryError())) {
+
 					// terminate the JVM immediately
 					// don't attempt a clean shutdown, because we cannot expect the clean shutdown to complete
 					try {

http://git-wip-us.apache.org/repos/asf/flink/blob/53168d00/flink-runtime/src/test/java/org/apache/flink/runtime/taskmanager/TaskTest.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/taskmanager/TaskTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/taskmanager/TaskTest.java
index 5b33d19..1829e97 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/taskmanager/TaskTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/taskmanager/TaskTest.java
@@ -29,8 +29,6 @@ import org.apache.flink.runtime.blob.TransientBlobCache;
 import org.apache.flink.runtime.broadcast.BroadcastVariableManager;
 import org.apache.flink.runtime.clusterframework.types.AllocationID;
 import org.apache.flink.runtime.concurrent.Executors;
-import org.apache.flink.runtime.deployment.InputGateDeploymentDescriptor;
-import org.apache.flink.runtime.deployment.ResultPartitionDeploymentDescriptor;
 import org.apache.flink.runtime.execution.CancelTaskException;
 import org.apache.flink.runtime.execution.Environment;
 import org.apache.flink.runtime.execution.ExecutionState;
@@ -103,12 +101,12 @@ import static org.mockito.Mockito.when;
  * Tests for the Task, which make sure that correct state transitions happen,
  * and failures are correctly handled.
  *
- * All tests here have a set of mock actors for TaskManager, JobManager, and
+ * <p>All tests here have a set of mock actors for TaskManager, JobManager, and
  * execution listener, which simply put the messages in a queue to be picked
  * up by the test and validated.
  */
 public class TaskTest extends TestLogger {
-	
+
 	private static OneShotLatch awaitLatch;
 	private static OneShotLatch triggerLatch;
 	private static OneShotLatch cancelLatch;
@@ -123,7 +121,7 @@ public class TaskTest extends TestLogger {
 	private BlockingQueue<Object> taskManagerMessages;
 	private BlockingQueue<Object> jobManagerMessages;
 	private BlockingQueue<Object> listenerMessages;
-	
+
 	@Before
 	public void createQueuesAndActors() {
 		taskManagerMessages = new LinkedBlockingQueue<>();
@@ -135,7 +133,7 @@ public class TaskTest extends TestLogger {
 
 		listener = new ActorGatewayTaskExecutionStateListener(listenerGateway);
 		taskManagerConnection = new ActorGatewayTaskManagerActions(taskManagerGateway);
-		
+
 		awaitLatch = new OneShotLatch();
 		triggerLatch = new OneShotLatch();
 		cancelLatch = new OneShotLatch();
@@ -155,32 +153,32 @@ public class TaskTest extends TestLogger {
 	// ------------------------------------------------------------------------
 	//  Tests
 	// ------------------------------------------------------------------------
-	
+
 	@Test
 	public void testRegularExecution() {
 		try {
 			Task task = createTask(TestInvokableCorrect.class);
-			
+
 			// task should be new and perfect
 			assertEquals(ExecutionState.CREATED, task.getExecutionState());
 			assertFalse(task.isCanceledOrFailed());
 			assertNull(task.getFailureCause());
-			
+
 			task.registerExecutionListener(listener);
-			
+
 			// go into the run method. we should switch to DEPLOYING, RUNNING, then
 			// FINISHED, and all should be good
 			task.run();
-			
+
 			// verify final state
 			assertEquals(ExecutionState.FINISHED, task.getExecutionState());
 			assertFalse(task.isCanceledOrFailed());
 			assertNull(task.getFailureCause());
-			
+
 			// verify listener messages
 			validateListenerMessage(ExecutionState.RUNNING, task, false);
 			validateListenerMessage(ExecutionState.FINISHED, task, false);
-			
+
 			// make sure that the TaskManager received an message to unregister the task
 			validateTaskManagerStateChange(ExecutionState.RUNNING, task, false);
 			validateUnregisterTask(task.getExecutionId());
@@ -198,7 +196,7 @@ public class TaskTest extends TestLogger {
 			task.cancelExecution();
 
 			assertEquals(ExecutionState.CANCELING, task.getExecutionState());
-			
+
 			task.run();
 
 			// verify final state
@@ -274,7 +272,7 @@ public class TaskTest extends TestLogger {
 			// mock a working library cache
 			LibraryCacheManager libCache = mock(LibraryCacheManager.class);
 			when(libCache.getClassLoader(any(JobID.class))).thenReturn(getClass().getClassLoader());
-			
+
 			// mock a network manager that rejects registration
 			ResultPartitionManager partitionManager = mock(ResultPartitionManager.class);
 			ResultPartitionConsumableNotifier consumableNotifier = mock(ResultPartitionConsumableNotifier.class);
@@ -296,7 +294,7 @@ public class TaskTest extends TestLogger {
 			assertEquals(ExecutionState.FAILED, task.getExecutionState());
 			assertTrue(task.isCanceledOrFailed());
 			assertTrue(task.getFailureCause().getMessage().contains("buffers"));
-			
+
 			validateUnregisterTask(task.getExecutionId());
 			validateListenerMessage(ExecutionState.FAILED, task, true);
 		}
@@ -326,13 +324,13 @@ public class TaskTest extends TestLogger {
 			fail(e.getMessage());
 		}
 	}
-	
+
 	@Test
 	public void testExecutionFailsInInvoke() {
 		try {
 			Task task = createTask(InvokableWithExceptionInInvoke.class);
 			task.registerExecutionListener(listener);
-			
+
 			task.run();
 
 			assertEquals(ExecutionState.FAILED, task.getExecutionState());
@@ -343,7 +341,7 @@ public class TaskTest extends TestLogger {
 
 			validateTaskManagerStateChange(ExecutionState.RUNNING, task, false);
 			validateUnregisterTask(task.getExecutionId());
-			
+
 			validateListenerMessage(ExecutionState.RUNNING, task, false);
 			validateListenerMessage(ExecutionState.FAILED, task, true);
 		}
@@ -378,7 +376,7 @@ public class TaskTest extends TestLogger {
 			fail(e.getMessage());
 		}
 	}
-	
+
 	@Test
 	public void testCancelDuringInvoke() {
 		try {
@@ -403,7 +401,7 @@ public class TaskTest extends TestLogger {
 
 			validateTaskManagerStateChange(ExecutionState.RUNNING, task, false);
 			validateUnregisterTask(task.getExecutionId());
-			
+
 			validateListenerMessage(ExecutionState.RUNNING, task, false);
 			validateCancelingAndCanceledListenerMessage(task);
 		}
@@ -463,7 +461,7 @@ public class TaskTest extends TestLogger {
 
 			validateTaskManagerStateChange(ExecutionState.RUNNING, task, false);
 			validateUnregisterTask(task.getExecutionId());
-			
+
 			validateListenerMessage(ExecutionState.RUNNING, task, false);
 			validateListenerMessage(ExecutionState.FAILED, task, true);
 		}
@@ -472,7 +470,7 @@ public class TaskTest extends TestLogger {
 			fail(e.getMessage());
 		}
 	}
-	
+
 	@Test
 	public void testExecutionFailesAfterCanceling() {
 		try {
@@ -487,7 +485,7 @@ public class TaskTest extends TestLogger {
 
 			task.cancelExecution();
 			assertEquals(ExecutionState.CANCELING, task.getExecutionState());
-			
+
 			// this causes an exception
 			triggerLatch.trigger();
 
@@ -497,7 +495,7 @@ public class TaskTest extends TestLogger {
 			assertEquals(ExecutionState.CANCELED, task.getExecutionState());
 			assertTrue(task.isCanceledOrFailed());
 			assertNull(task.getFailureCause());
-			
+
 			validateTaskManagerStateChange(ExecutionState.RUNNING, task, false);
 			validateUnregisterTask(task.getExecutionId());
 
@@ -529,11 +527,11 @@ public class TaskTest extends TestLogger {
 			triggerLatch.trigger();
 
 			task.getExecutingThread().join();
-			
+
 			assertEquals(ExecutionState.FAILED, task.getExecutionState());
 			assertTrue(task.isCanceledOrFailed());
 			assertTrue(task.getFailureCause().getMessage().contains("external"));
-			
+
 			validateTaskManagerStateChange(ExecutionState.RUNNING, task, false);
 			validateUnregisterTask(task.getExecutionId());
 
@@ -606,7 +604,7 @@ public class TaskTest extends TestLogger {
 		expected.put(ExecutionState.SCHEDULED, ExecutionState.RUNNING);
 		expected.put(ExecutionState.DEPLOYING, ExecutionState.RUNNING);
 		expected.put(ExecutionState.FINISHED, ExecutionState.RUNNING);
-		
+
 		expected.put(ExecutionState.CANCELED, ExecutionState.CANCELING);
 		expected.put(ExecutionState.CANCELING, ExecutionState.CANCELING);
 		expected.put(ExecutionState.FAILED, ExecutionState.CANCELING);
@@ -901,10 +899,9 @@ public class TaskTest extends TestLogger {
 	 * @return BlobCache mock with the bare minimum of implemented functions that work
 	 */
 	private BlobCacheService createBlobCache() {
-		BlobCacheService blobService =
-			new BlobCacheService(mock(PermanentBlobCache.class), mock(TransientBlobCache.class));
-
-		return blobService;
+		return new BlobCacheService(
+				mock(PermanentBlobCache.class),
+				mock(TransientBlobCache.class));
 	}
 
 	private Task createTask(Class<? extends AbstractInvokable> invokable) throws IOException {
@@ -915,14 +912,14 @@ public class TaskTest extends TestLogger {
 		BlobCacheService blobService = createBlobCache();
 		LibraryCacheManager libCache = mock(LibraryCacheManager.class);
 		when(libCache.getClassLoader(any(JobID.class))).thenReturn(getClass().getClassLoader());
-		return createTask(invokable, blobService,libCache, config, new ExecutionConfig());
+		return createTask(invokable, blobService, libCache, config, new ExecutionConfig());
 	}
 
 	private Task createTask(Class<? extends AbstractInvokable> invokable, Configuration config, ExecutionConfig execConfig) throws IOException {
 		BlobCacheService blobService = createBlobCache();
 		LibraryCacheManager libCache = mock(LibraryCacheManager.class);
 		when(libCache.getClassLoader(any(JobID.class))).thenReturn(getClass().getClassLoader());
-		return createTask(invokable, blobService,libCache, config, execConfig);
+		return createTask(invokable, blobService, libCache, config, execConfig);
 	}
 
 	private Task createTask(
@@ -930,7 +927,7 @@ public class TaskTest extends TestLogger {
 			BlobCacheService blobService,
 			LibraryCacheManager libCache) throws IOException {
 
-		return createTask(invokable, blobService,libCache, new Configuration(), new ExecutionConfig());
+		return createTask(invokable, blobService, libCache, new Configuration(), new ExecutionConfig());
 	}
 
 	private Task createTask(
@@ -965,7 +962,7 @@ public class TaskTest extends TestLogger {
 			Executor executor) throws IOException {
 		return createTask(invokable, blobService, libCache, networkEnvironment, consumableNotifier, partitionProducerStateChecker, executor, new Configuration(), new ExecutionConfig());
 	}
-	
+
 	private Task createTask(
 		Class<? extends AbstractInvokable> invokable,
 		BlobCacheService blobService,
@@ -976,7 +973,7 @@ public class TaskTest extends TestLogger {
 		Executor executor,
 		Configuration taskManagerConfig,
 		ExecutionConfig execConfig) throws IOException {
-		
+
 		JobID jobId = new JobID();
 		JobVertexID jobVertexId = new JobVertexID();
 		ExecutionAttemptID executionAttemptId = new ExecutionAttemptID();
@@ -1010,7 +1007,7 @@ public class TaskTest extends TestLogger {
 
 		TaskMetricGroup taskMetricGroup = mock(TaskMetricGroup.class);
 		when(taskMetricGroup.getIOMetricGroup()).thenReturn(mock(TaskIOMetricGroup.class));
-		
+
 		return new Task(
 			jobInformation,
 			taskInformation,
@@ -1018,8 +1015,8 @@ public class TaskTest extends TestLogger {
 			new AllocationID(),
 			0,
 			0,
-			Collections.<ResultPartitionDeploymentDescriptor>emptyList(),
-			Collections.<InputGateDeploymentDescriptor>emptyList(),
+			Collections.emptyList(),
+			Collections.emptyList(),
 			0,
 			mock(MemoryManager.class),
 			mock(IOManager.class),
@@ -1042,18 +1039,18 @@ public class TaskTest extends TestLogger {
 	// ------------------------------------------------------------------------
 	// Validation Methods
 	// ------------------------------------------------------------------------
-	
+
 	private void validateUnregisterTask(ExecutionAttemptID id) {
 		try {
 			// we may have to wait for a bit to give the actors time to receive the message
 			// and put it into the queue
 			Object rawMessage = taskManagerMessages.take();
-			
+
 			assertNotNull("There is no additional TaskManager message", rawMessage);
 			if (!(rawMessage instanceof TaskMessages.TaskInFinalState)) {
 				fail("TaskManager message is not 'UnregisterTask', but " + rawMessage.getClass());
 			}
-			
+
 			TaskMessages.TaskInFinalState message = (TaskMessages.TaskInFinalState) rawMessage;
 			assertEquals(id, message.executionID());
 		}
@@ -1072,10 +1069,10 @@ public class TaskTest extends TestLogger {
 			if (!(rawMessage instanceof TaskMessages.UpdateTaskExecutionState)) {
 				fail("TaskManager message is not 'UpdateTaskExecutionState', but " + rawMessage.getClass());
 			}
-			
+
 			TaskMessages.UpdateTaskExecutionState message =
 					(TaskMessages.UpdateTaskExecutionState) rawMessage;
-			
+
 			TaskExecutionState taskState =  message.taskExecutionState();
 
 			assertEquals(task.getJobID(), taskState.getJobID());
@@ -1092,7 +1089,7 @@ public class TaskTest extends TestLogger {
 			fail("interrupted");
 		}
 	}
-	
+
 	private void validateListenerMessage(ExecutionState state, Task task, boolean hasError) {
 		try {
 			// we may have to wait for a bit to give the actors time to receive the message
@@ -1100,13 +1097,13 @@ public class TaskTest extends TestLogger {
 			TaskMessages.UpdateTaskExecutionState message =
 					(TaskMessages.UpdateTaskExecutionState) listenerMessages.take();
 			assertNotNull("There is no additional listener message", message);
-			
+
 			TaskExecutionState taskState =  message.taskExecutionState();
 
 			assertEquals(task.getJobID(), taskState.getJobID());
 			assertEquals(task.getExecutionId(), taskState.getID());
 			assertEquals(state, taskState.getExecutionState());
-			
+
 			if (hasError) {
 				assertNotNull(taskState.getError(getClass().getClassLoader()));
 			} else {
@@ -1126,8 +1123,7 @@ public class TaskTest extends TestLogger {
 					(TaskMessages.UpdateTaskExecutionState) listenerMessages.take();
 			TaskMessages.UpdateTaskExecutionState message2 =
 					(TaskMessages.UpdateTaskExecutionState) listenerMessages.take();
-			
-			
+
 			assertNotNull("There is no additional listener message", message1);
 			assertNotNull("There is no additional listener message", message2);
 
@@ -1138,30 +1134,31 @@ public class TaskTest extends TestLogger {
 			assertEquals(task.getJobID(), taskState2.getJobID());
 			assertEquals(task.getExecutionId(), taskState1.getID());
 			assertEquals(task.getExecutionId(), taskState2.getID());
-			
+
 			ExecutionState state1 = taskState1.getExecutionState();
 			ExecutionState state2 = taskState2.getExecutionState();
-			
+
 			// it may be (very rarely) that the following race happens:
 			//  - OUTSIDE THREAD: call to cancel()
 			//  - OUTSIDE THREAD: atomic state change from running to canceling
 			//  - TASK THREAD: finishes, atomic change from canceling to canceled
 			//  - TASK THREAD: send notification that state is canceled
 			//  - OUTSIDE THREAD: send notification that state is canceling
-			
+
 			// for that reason, we allow the notification messages in any order.
-			assertTrue( (state1 == ExecutionState.CANCELING && state2 == ExecutionState.CANCELED) ||
+			assertTrue((state1 == ExecutionState.CANCELING && state2 == ExecutionState.CANCELED) ||
 						(state2 == ExecutionState.CANCELING && state1 == ExecutionState.CANCELED));
 		}
 		catch (InterruptedException e) {
 			fail("interrupted");
 		}
 	}
-	
+
 	// --------------------------------------------------------------------------------------------
 	//  Mock invokable code
 	// --------------------------------------------------------------------------------------------
-	
+
+	/** Test task class. */
 	public static final class TestInvokableCorrect extends AbstractInvokable {
 
 		public TestInvokableCorrect(Environment environment) {
@@ -1177,6 +1174,7 @@ public class TaskTest extends TestLogger {
 		}
 	}
 
+	/** Test task class. */
 	public static final class InvokableWithExceptionInInvoke extends AbstractInvokable {
 
 		public InvokableWithExceptionInInvoke(Environment environment) {
@@ -1189,6 +1187,7 @@ public class TaskTest extends TestLogger {
 		}
 	}
 
+	/** Test task class. */
 	public static final class InvokableWithExceptionOnTrigger extends AbstractInvokable {
 
 		public InvokableWithExceptionOnTrigger(Environment environment) {
@@ -1198,7 +1197,7 @@ public class TaskTest extends TestLogger {
 		@Override
 		public void invoke() {
 			awaitLatch.trigger();
-			
+
 			// make sure that the interrupt call does not
 			// grab us out of the lock early
 			while (true) {
@@ -1215,13 +1214,15 @@ public class TaskTest extends TestLogger {
 		}
 	}
 
-	public static abstract class InvokableNonInstantiable extends AbstractInvokable {
+	/** Test task class. */
+	public abstract static class InvokableNonInstantiable extends AbstractInvokable {
 
 		public InvokableNonInstantiable(Environment environment) {
 			super(environment);
 		}
 	}
 
+	/** Test task class. */
 	public static final class InvokableBlockingInInvoke extends AbstractInvokable {
 
 		public InvokableBlockingInInvoke(Environment environment) {
@@ -1231,7 +1232,7 @@ public class TaskTest extends TestLogger {
 		@Override
 		public void invoke() throws Exception {
 			awaitLatch.trigger();
-			
+
 			// block forever
 			synchronized (this) {
 				wait();
@@ -1239,6 +1240,7 @@ public class TaskTest extends TestLogger {
 		}
 	}
 
+	/** Test task class. */
 	public static final class InvokableWithCancelTaskExceptionInInvoke extends AbstractInvokable {
 
 		public InvokableWithCancelTaskExceptionInInvoke(Environment environment) {
@@ -1253,11 +1255,12 @@ public class TaskTest extends TestLogger {
 				triggerLatch.await();
 			}
 			catch (Throwable ignored) {}
-			
+
 			throw new CancelTaskException();
 		}
 	}
 
+	/** Test task class. */
 	public static final class InvokableInterruptableSharedLockInInvokeAndCancel extends AbstractInvokable {
 
 		private final Object lock = new Object();
@@ -1282,6 +1285,7 @@ public class TaskTest extends TestLogger {
 		}
 	}
 
+	/** Test task class. */
 	public static final class InvokableBlockingInCancel extends AbstractInvokable {
 
 		public InvokableBlockingInCancel(Environment environment) {
@@ -1313,6 +1317,7 @@ public class TaskTest extends TestLogger {
 		}
 	}
 
+	/** Test task class. */
 	public static final class InvokableUninterruptibleBlockingInvoke extends AbstractInvokable {
 
 		public InvokableUninterruptibleBlockingInvoke(Environment environment) {
@@ -1337,6 +1342,7 @@ public class TaskTest extends TestLogger {
 		}
 	}
 
+	/** Test task class. */
 	public static final class FailingInvokableWithChainedException extends AbstractInvokable {
 
 		public FailingInvokableWithChainedException(Environment environment) {


[3/5] flink git commit: [FLINK-8883] [core] Make ThreadDeath a fatal error in ExceptionUtils

Posted by se...@apache.org.
[FLINK-8883] [core] Make ThreadDeath a fatal error in ExceptionUtils


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/1d77b668
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/1d77b668
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/1d77b668

Branch: refs/heads/master
Commit: 1d77b66833e75359dd4088f01083ecd9b68898ff
Parents: 1e12376
Author: Stephan Ewen <se...@apache.org>
Authored: Tue Mar 6 16:36:13 2018 +0100
Committer: Stephan Ewen <se...@apache.org>
Committed: Thu Mar 8 16:22:08 2018 +0100

----------------------------------------------------------------------
 .../src/main/java/org/apache/flink/util/ExceptionUtils.java     | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/1d77b668/flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java b/flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java
index b9a21ae..6af16fc 100644
--- a/flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java
+++ b/flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java
@@ -81,12 +81,15 @@ public final class ExceptionUtils {
 	 * <p>Currently considered fatal exceptions are Virtual Machine errors indicating
 	 * that the JVM is corrupted, like {@link InternalError}, {@link UnknownError},
 	 * and {@link java.util.zip.ZipError} (a special case of InternalError).
+	 * The {@link ThreadDeath} exception is also treated as a fatal error, because when
+	 * a thread is forcefully stopped, there is a high chance that parts of the system
+	 * are in an inconsistent state.
 	 *
 	 * @param t The exception to check.
 	 * @return True, if the exception is considered fatal to the JVM, false otherwise.
 	 */
 	public static boolean isJvmFatalError(Throwable t) {
-		return (t instanceof InternalError) || (t instanceof UnknownError);
+		return (t instanceof InternalError) || (t instanceof UnknownError) || (t instanceof ThreadDeath);
 	}
 
 	/**