[ 
https://issues.apache.org/jira/browse/FLINK-9304?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16467587#comment-16467587
 ] 

ASF GitHub Bot commented on FLINK-9304:
---------------------------------------

Github user sihuazhou commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5962#discussion_r186775375
  
    --- Diff: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java
 ---
    @@ -706,6 +689,38 @@ public void notifyCheckpointComplete(long 
checkpointId) throws Exception {
                }
        }
     
    +   private void tryShutdownTimerService() {
    +           if (timerService != null && !timerService.isTerminated()) {
    +                   try {
    +
    +                           final long totalTimeoutMs = 
getEnvironment().getTaskManagerInfo().getConfiguration().
    +                                   
getLong(TaskManagerOptions.TASK_CANCELLATION_TIMEOUT_TIMERS);
    +
    +                           final Deadline deadline = 
Deadline.fromNow(Duration.ofMillis(totalTimeoutMs));
    +
    +                           boolean timerServiceShutdownComplete = false;
    +
    +                           while (!timerServiceShutdownComplete && 
deadline.hasTimeLeft()) {
    +                                   try {
    --- End diff --
    
    Shall we at least try to shutdown the time service one time? If so, I think 
maybe we should use `do {...} while()` here.


> Timer service shutdown should not be interrupted
> ------------------------------------------------
>
>                 Key: FLINK-9304
>                 URL: https://issues.apache.org/jira/browse/FLINK-9304
>             Project: Flink
>          Issue Type: Bug
>          Components: Streaming
>    Affects Versions: 1.5.0, 1.4.2, 1.6.0
>            Reporter: Stefan Richter
>            Assignee: Stefan Richter
>            Priority: Major
>
> Shutting down the timer service inĀ {{StreamTask::invoke}} can be interrupted 
> by the cancellation thread and make waiting for the shutdown exit prematurely.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to