Skip to content

Commit

Permalink
[ML] Fix possible race condition starting datafeed (#51646)
Browse files Browse the repository at this point in the history
Datafeeds being closed while starting could result in and NPE. This was
handled as any other failure, masking out the NPE. However, this
conflicts with the changes in #50886.

Related to #50886 and #51302
  • Loading branch information
henningandersen authored Jan 30, 2020
1 parent 0e38bd8 commit f891a0d
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,12 @@ private void runTask(TransportStartDatafeedAction.DatafeedTask task) {
// a context with sufficient permissions would coincidentally be in force in some single node
// tests, leading to bugs not caught in CI due to many tests running in single node test clusters.
try (ThreadContext.StoredContext ignore = threadPool.getThreadContext().stashContext()) {
innerRun(runningDatafeedsOnThisNode.get(task.getAllocationId()), task.getDatafeedStartTime(), task.getEndTime());
Holder holder = runningDatafeedsOnThisNode.get(task.getAllocationId());
if (holder != null) {
innerRun(holder, task.getDatafeedStartTime(), task.getEndTime());
} else {
logger.warn("Datafeed [{}] was stopped while being started", task.getDatafeedId());
}
}
}

Expand Down

0 comments on commit f891a0d

Please sign in to comment.