rkhachatryan commented on a change in pull request #10345: 
[FLINK-12484][runtime] synchronize all mailbox actions
URL: https://github.com/apache/flink/pull/10345#discussion_r353776003
 
 

 ##########
 File path: 
flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamTaskTest.java
 ##########
 @@ -1433,35 +1423,16 @@ protected void init() {}
 
                @Override
                protected void processInput(MailboxDefaultAction.Controller 
controller) throws Exception {
-                       holder = new LockHolder(getCheckpointLock(), latch);
-                       holder.start();
-                       latch.await();
-
-                       // we are at the point where cancelling can happen
-                       syncLatch.trigger();
-
-                       // just put this to sleep until it is interrupted
-                       try {
-                               Thread.sleep(100000000);
-                       } catch (InterruptedException ignored) {
-                               // restore interruption state
-                               Thread.currentThread().interrupt();
+                       syncLatch.trigger(); // signal that the task can be 
cancelled now
+                       while (task.getExecutionState() == 
ExecutionState.RUNNING) { // wait for the containing task to be terminated from 
the outside
+                               try {
+                                       Thread.sleep(50);
+                               } catch (InterruptedException e) {
+                                       LOG.debug("interrupted while waiting 
for state transition", e);
+                                       Thread.currentThread().interrupt();
+                               }
 
 Review comment:
   To summarize offline discussion:
   
   > Does this solve all of the issues?
   
   No, it only solves this particular issue.
   There are scenarios where shutting down can hang out because of mis-behaving 
source threads. Before the mailbox model it wasn't an issue.
   To address it we need to change the shutdown behaviour (`Task` and 
`StreamTask`).
   
   > Maybe this test is just invalid and could be dropped?
   
   The test is valid but probably test for an esoteric situation.
   
   Still, we decided to keep it and the associated change, because:
   1) internal mailbox actions shouldn't acquire the lock
   2) it's not trivial to enqueue an email that touches task state and doesn't 
acquire the lock

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to