Github user KurtYoung commented on a diff in the pull request: https://github.com/apache/flink/pull/3488#discussion_r105067829 --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/JobLeaderIdService.java --- @@ -283,5 +302,31 @@ public void handleError(Exception exception) { JobLeaderIdListener.class.getSimpleName(), exception); } } + + private void activateTimeout() { + if (timeoutId != null) { + cancelTimeout(); + } + + final UUID newTimeoutId = UUID.randomUUID(); + + timeoutId = newTimeoutId; + + timeoutFuture = scheduledExecutor.schedule(new Runnable() { + @Override + public void run() { + listenerJobLeaderIdActions.notifyJobTimeout(jobId, newTimeoutId); --- End diff -- I think this thread is different with the leader retrieve thread which will call "notifyLeaderAddress", right? So is this possible that when a job is close to timeout, and then comes the notification of leader address, both threads are trying to `cancelTimeout`, NPE will be thrown if one of them trying to call `timeoutFuture.cancel(true)`, while the other one has set `timeoutFuture = null`
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---