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 2017/06/21 04:05:20 UTC
[2/2] flink git commit: [FLINK-6945] Fix
TaskCancelAsyncProducerConsumerITCase by removing race condition
[FLINK-6945] Fix TaskCancelAsyncProducerConsumerITCase by removing race condition
The TaskCacnelAsyncProducerConsumerITCase#testCancelAsyncProducerAndConsumer test case
sometimes failed with a NPE because of a race condition. The problem was that some
invokables set static fields which are checked in the main thread. Since we checked
the wrong field, the one for the consumer, after making sure that the producer
is running, this could lead to a race condition if the consumer wasn't running yet.
This closes #4139.
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/a2768695
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/a2768695
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/a2768695
Branch: refs/heads/release-1.3
Commit: a2768695923dc48ba02fa7714d82d833ca98a092
Parents: 70f3344
Author: Till Rohrmann <tr...@apache.org>
Authored: Mon Jun 19 09:54:35 2017 +0200
Committer: Till Rohrmann <tr...@apache.org>
Committed: Wed Jun 21 11:54:18 2017 +0800
----------------------------------------------------------------------
.../taskmanager/TaskCancelAsyncProducerConsumerITCase.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/a2768695/flink-runtime/src/test/java/org/apache/flink/runtime/taskmanager/TaskCancelAsyncProducerConsumerITCase.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/taskmanager/TaskCancelAsyncProducerConsumerITCase.java b/flink-runtime/src/test/java/org/apache/flink/runtime/taskmanager/TaskCancelAsyncProducerConsumerITCase.java
index 4ea6511..69f1a49 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/taskmanager/TaskCancelAsyncProducerConsumerITCase.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/taskmanager/TaskCancelAsyncProducerConsumerITCase.java
@@ -126,12 +126,12 @@ public class TaskCancelAsyncProducerConsumerITCase extends TestLogger {
break;
} else {
// Retry
- Thread.sleep(500);
+ Thread.sleep(500L);
}
}
// Verify that async producer is in blocking request
- assertTrue("Producer thread is not blocked: " + Arrays.toString(ASYNC_CONSUMER_THREAD.getStackTrace()), producerBlocked);
+ assertTrue("Producer thread is not blocked: " + Arrays.toString(ASYNC_PRODUCER_THREAD.getStackTrace()), producerBlocked);
boolean consumerWaiting = false;
for (int i = 0; i < 50; i++) {
@@ -145,7 +145,7 @@ public class TaskCancelAsyncProducerConsumerITCase extends TestLogger {
break;
} else {
// Retry
- Thread.sleep(500);
+ Thread.sleep(500L);
}
}