You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by pn...@apache.org on 2021/11/01 11:24:12 UTC

[flink] branch release-1.12 updated: [FLINK-15550][runtime] Don't ignore the interruption for testCancelTaskExceptionAfterTaskMarkedFailed

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

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


The following commit(s) were added to refs/heads/release-1.12 by this push:
     new 3d1f06e  [FLINK-15550][runtime] Don't ignore the interruption for testCancelTaskExceptionAfterTaskMarkedFailed
3d1f06e is described below

commit 3d1f06eb8cd8d6f9d6a4ecfb9656b023a7522e52
Author: Anton Kalashnikov <ka...@yandex.ru>
AuthorDate: Mon Oct 25 14:12:52 2021 +0200

    [FLINK-15550][runtime] Don't ignore the interruption for testCancelTaskExceptionAfterTaskMarkedFailed
---
 .../apache/flink/runtime/taskmanager/TaskTest.java | 35 +++++++++++-----------
 1 file changed, 17 insertions(+), 18 deletions(-)

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 b67dff1..c6790e1 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
@@ -1133,23 +1133,27 @@ 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) {
-                try {
-                    triggerLatch.await();
-                    break;
-                } catch (InterruptedException e) {
-                    // fall through the loop
-                }
-            }
+            awaitTriggerLatch();
 
             throw new RuntimeException("test");
         }
     }
 
+    private static void awaitTriggerLatch() {
+        awaitLatch.trigger();
+
+        // make sure that the interrupt call does not
+        // grab us out of the lock early
+        while (true) {
+            try {
+                triggerLatch.await();
+                break;
+            } catch (InterruptedException e) {
+                // fall through the loop
+            }
+        }
+    }
+
     /** {@link AbstractInvokable} which throws {@link CancelTaskException} on invoke. */
     public static final class InvokableWithCancelTaskExceptionInInvoke extends AbstractInvokable {
         public InvokableWithCancelTaskExceptionInInvoke(Environment environment) {
@@ -1158,12 +1162,7 @@ public class TaskTest extends TestLogger {
 
         @Override
         public void invoke() {
-            awaitLatch.trigger();
-
-            try {
-                triggerLatch.await();
-            } catch (Throwable ignored) {
-            }
+            awaitTriggerLatch();
 
             throw new CancelTaskException();
         }