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 03:51:14 UTC

[3/3] 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/0c4f7988
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/0c4f7988
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/0c4f7988

Branch: refs/heads/master
Commit: 0c4f7988dc8c947eb7bda3afa8c58ace04d4d1d8
Parents: 47862af
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:33:14 2017 +0800

----------------------------------------------------------------------
 .../taskmanager/TaskCancelAsyncProducerConsumerITCase.java     | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/0c4f7988/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);
 				}
 			}