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 2020/04/08 11:50:25 UTC

[flink] branch release-1.10 updated: [FLINK-15751][task] Let all exceptions propagate from the StreamTask#runMailboxLoop

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

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


The following commit(s) were added to refs/heads/release-1.10 by this push:
     new d7e2472  [FLINK-15751][task] Let all exceptions propagate from the StreamTask#runMailboxLoop
d7e2472 is described below

commit d7e247209358779b6485062b69965b83043fb59d
Author: Piotr Nowojski <pi...@gmail.com>
AuthorDate: Fri Jan 24 16:36:47 2020 +0100

    [FLINK-15751][task] Let all exceptions propagate from the StreamTask#runMailboxLoop
    
    If the StreamTask is being cancelled, let the Task handle the exception.
---
 .../flink/streaming/runtime/tasks/StreamTask.java     | 19 +------------------
 .../streaming/runtime/tasks/SourceStreamTaskTest.java |  5 +++--
 tools/travis/splits/split_checkpoints.sh              |  2 +-
 3 files changed, 5 insertions(+), 21 deletions(-)

diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java
index 4d5ebf6..1337ce0 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java
@@ -87,7 +87,6 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Optional;
 import java.util.OptionalLong;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ExecutorService;
@@ -483,23 +482,7 @@ public abstract class StreamTask<OUT, OP extends StreamOperator<OUT>>
 	}
 
 	private void runMailboxLoop() throws Exception {
-		try {
-			mailboxProcessor.runMailboxLoop();
-		}
-		catch (Exception e) {
-			Optional<InterruptedException> interruption = ExceptionUtils.findThrowable(e, InterruptedException.class);
-			if (interruption.isPresent()) {
-				if (!canceled) {
-					Thread.currentThread().interrupt();
-					throw interruption.get();
-				}
-			} else if (canceled) {
-				LOG.warn("Error while canceling task.", e);
-			}
-			else {
-				throw e;
-			}
-		}
+		mailboxProcessor.runMailboxLoop();
 	}
 
 	private void afterInvoke() throws Exception {
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/SourceStreamTaskTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/SourceStreamTaskTest.java
index 1a329ed..4239b57 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/SourceStreamTaskTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/SourceStreamTaskTest.java
@@ -312,7 +312,8 @@ public class SourceStreamTaskTest {
 		try {
 			testHarness.waitForTaskCompletion();
 		} catch (Throwable t) {
-			if (!ExceptionUtils.findThrowable(t, CancelTaskException.class).isPresent()) {
+			if (!ExceptionUtils.findThrowable(t, InterruptedException.class).isPresent() &&
+				!ExceptionUtils.findThrowable(t, CancelTaskException.class).isPresent()) {
 				throw t;
 			}
 		}
@@ -406,7 +407,7 @@ public class SourceStreamTaskTest {
 		try {
 			testHarness.waitForTaskCompletion();
 		} catch (Exception e) {
-			if (!(e.getCause() instanceof InterruptedException)) {
+			if (!ExceptionUtils.findThrowable(e, InterruptedException.class).isPresent()) {
 				throw e;
 			}
 		}
diff --git a/tools/travis/splits/split_checkpoints.sh b/tools/travis/splits/split_checkpoints.sh
index 95e7c46..2809354 100755
--- a/tools/travis/splits/split_checkpoints.sh
+++ b/tools/travis/splits/split_checkpoints.sh
@@ -74,7 +74,7 @@ run_test "Resuming Externalized Checkpoint after terminal failure (file, sync) e
 run_test "Resuming Externalized Checkpoint after terminal failure (rocks, non-incremental) end-to-end test" "$END_TO_END_DIR/test-scripts/test_resume_externalized_checkpoints.sh 2 2 rocks true false true" "skip_check_exceptions"
 run_test "Resuming Externalized Checkpoint after terminal failure (rocks, incremental) end-to-end test" "$END_TO_END_DIR/test-scripts/test_resume_externalized_checkpoints.sh 2 2 rocks true true true" "skip_check_exceptions"
 
-run_test "RocksDB Memory Management end-to-end test" "$END_TO_END_DIR/test-scripts/test_rocksdb_state_memory_control.sh" "skip_check_exceptions"
+run_test "RocksDB Memory Management end-to-end test" "$END_TO_END_DIR/test-scripts/test_rocksdb_state_memory_control.sh"
 
 printf "\n[PASS] All tests passed\n"
 exit 0