You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2021/10/07 08:05:11 UTC

[GitHub] [flink] dawidwys commented on a change in pull request #17253: [FLINK-24182][task] Do not interrupt tasks/operators that are already closing

dawidwys commented on a change in pull request #17253:
URL: https://github.com/apache/flink/pull/17253#discussion_r723934098



##########
File path: flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamTaskTestHarness.java
##########
@@ -324,16 +324,19 @@ public void waitForTaskCompletion(long timeout) throws Exception {
      *
      * @param timeout Timeout for the task completion
      */
-    public void waitForTaskCompletion(long timeout, boolean ignoreCancellationException)
-            throws Exception {
+    public void waitForTaskCompletion(
+            long timeout, boolean ignoreCancellationOrInterruptedException) throws Exception {
         Preconditions.checkState(taskThread != null, "Task thread was not started.");
 
         taskThread.join(timeout);
         if (taskThread.getError() != null) {
-            if (!ignoreCancellationException
-                    || !ExceptionUtils.findThrowable(
-                                    taskThread.getError(), CancelTaskException.class)
-                            .isPresent()) {
+            boolean errorIsCancellationOrInterrupted =
+                    ExceptionUtils.findThrowable(taskThread.getError(), CancelTaskException.class)
+                                    .isPresent()
+                            || ExceptionUtils.findThrowable(
+                                            taskThread.getError(), InterruptedException.class)
+                                    .isPresent();
+            if (!ignoreCancellationOrInterruptedException || !errorIsCancellationOrInterrupted) {

Review comment:
       nit: Could we revert the condition? I find way easier to reason without negations:
   ```
   if (ignoreCancellationOrInterruptedException && errorIsCancellationOrInterrupted) {
     return;
   }
   
   throw new Exception("error in task", taskThread.getError());
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org