You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tr...@apache.org on 2020/05/06 07:24:15 UTC

[flink] 03/04: [FLINK-17514] Fail fatally if the TaskCancelerWatchDog encounters exception in run method

This is an automated email from the ASF dual-hosted git repository.

trohrmann pushed a commit to branch release-1.10
in repository https://gitbox.apache.org/repos/asf/flink.git

commit f3f1bd3020c473d65fe8963262b8962d20e84d6d
Author: Till Rohrmann <tr...@apache.org>
AuthorDate: Tue May 5 11:47:12 2020 +0200

    [FLINK-17514] Fail fatally if the TaskCancelerWatchDog encounters exception in run method
    
    If the TaskCancelerWatchDog encounters an exception in the run method, then we can no longer
    guarantee that it will do its job. Hence, it is best to fail fatally by letting the exception
    bubble up so that it is handled by the uncaught exception handler.
---
 .../java/org/apache/flink/runtime/taskmanager/Task.java     | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

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 0b35df0..d7f3d65 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
@@ -1082,8 +1082,7 @@ public class Task implements Runnable, TaskSlotPayload, TaskActions, PartitionPr
 							Runnable cancelWatchdog = new TaskCancelerWatchDog(
 									executingThread,
 									taskManagerActions,
-									taskCancellationTimeout,
-									LOG);
+									taskCancellationTimeout);
 
 							Thread watchDogThread = new Thread(
 									executingThread.getThreadGroup(),
@@ -1460,9 +1459,6 @@ public class Task implements Runnable, TaskSlotPayload, TaskActions, PartitionPr
 	 */
 	private static class TaskCancelerWatchDog implements Runnable {
 
-		/** The logger to report on the fatal condition. */
-		private final Logger log;
-
 		/** The executing task thread that we wait for to terminate. */
 		private final Thread executerThread;
 
@@ -1475,12 +1471,10 @@ public class Task implements Runnable, TaskSlotPayload, TaskActions, PartitionPr
 		TaskCancelerWatchDog(
 				Thread executerThread,
 				TaskManagerActions taskManager,
-				long timeoutMillis,
-				Logger log) {
+				long timeoutMillis) {
 
 			checkArgument(timeoutMillis > 0);
 
-			this.log = log;
 			this.executerThread = executerThread;
 			this.taskManager = taskManager;
 			this.timeoutMillis = timeoutMillis;
@@ -1509,8 +1503,7 @@ public class Task implements Runnable, TaskSlotPayload, TaskActions, PartitionPr
 				}
 			}
 			catch (Throwable t) {
-				ExceptionUtils.rethrowIfFatalError(t);
-				log.error("Error in Task Cancellation Watch Dog", t);
+				throw new FlinkRuntimeException("Error in Task Cancellation Watch Dog", t);
 			}
 		}
 	}