Github user uce commented on a diff in the pull request: https://github.com/apache/flink/pull/2652#discussion_r83824898 --- Diff: flink-runtime/src/test/java/org/apache/flink/runtime/taskmanager/TaskTest.java --- @@ -565,6 +568,50 @@ public void testOnPartitionStateUpdate() throws Exception { verify(inputGate, times(1)).retriggerPartitionRequest(eq(partitionId.getPartitionId())); } + /** + * Task cancellation blocks the task canceller. Interrupt after cancel via + * cancellation watch dog. + */ + @Test + public void testTaskCancelWatchDog() throws Exception { + Configuration config = new Configuration(); + config.setLong(ConfigConstants.TASK_CANCELLATION_INTERVAL_MILLIS, 100); + config.setLong(ConfigConstants.TASK_CANCELLATION_TIMEOUT_MILLIS, 1000); + + Task task = createTask(InvokableBlockingInCancel.class, config); + task.startTaskThread(); + + awaitLatch.await(); + + task.cancelExecution(); + + triggerLatch.await(); + } + + @Test + public void testReportFatalErrorAfterCancellationTimeout() throws Exception { + Configuration config = new Configuration(); + config.setLong(ConfigConstants.TASK_CANCELLATION_INTERVAL_MILLIS, 10); + config.setLong(ConfigConstants.TASK_CANCELLATION_TIMEOUT_MILLIS, 200); + + Task task = createTask(InvokableBlockingInvokeAndCancel.class, config); + task.startTaskThread(); + + awaitLatch.await(); + + task.cancelExecution(); + + for (int i = 0; i < 10; i++) { + Object msg = taskManagerMessages.poll(1, TimeUnit.SECONDS); + if (msg instanceof TaskManagerMessages.FatalError) { + System.out.println(msg); + return; // success + } + } + + fail("Did not receive expected task manager message"); --- End diff -- Good catch. Will let the test thread let it shut down.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---