gaoyunhaii commented on a change in pull request #16184:
URL: https://github.com/apache/flink/pull/16184#discussion_r670199167



##########
File path: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/SourceStreamTask.java
##########
@@ -215,6 +224,11 @@ private void cancelTask(boolean interrupt) {
     }
 
     private void interruptSourceThread(boolean interrupt) {
+        // Nothing need to do if the source is finished on restore
+        if (operatorChain != null && operatorChain.isFinishedOnRestore()) {

Review comment:
       Here we should judge if `operatorChain` is null since `cancel` might 
happen before the task is successfully initialized. 
   
   Although the `cancel` might be called from different thread other than the 
main thread, there might be small probability the `operatorChain` is set but 
not detected, but this should also not cause problem in considering the 
following process. Thus for now we would not change `operatorChain` to 
`volatile`, which is also similar to the current `mainOperator` variable. 




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to