rkhachatryan commented on code in PR #21923:
URL: https://github.com/apache/flink/pull/21923#discussion_r1112276499


##########
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java:
##########
@@ -949,7 +952,9 @@ public final void cleanUp(Throwable throwable) throws 
Exception {
         // disabled the interruptions or not.
         getCompletionFuture().exceptionally(unused -> null).join();
         // clean up everything we initialized
-        isRunning = false;
+        if (!isCanceled() && !isFailing()) {

Review Comment:
   I agree, FSM makes sense.
   
   But I also agree, that all the combinations and changes are tricky.
   
   So maybe if the purpose of the PR is to reduce `volatile` accesses, I'd 
rather move all three flags into the state object, and  reflect their exact 
same values there.
   For example, replace `isRunning = false;` with `taskState = 
taskState.stopped();`  where `stopped()` returns a new state object with 
`running = false` inside.
   
   On a side note, those `volatile` accesses aren't on the hot path so 
performance-wise it shouldn't change much.



-- 
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-unsubscr...@flink.apache.org

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

Reply via email to