Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] Fix possible race condition starting datafeed #51646

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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());
Copy link
Contributor Author

@henningandersen henningandersen Jan 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Putting in a sleep(100) before this line provokes the NPE.

if (holder != null) {
innerRun(holder, task.getDatafeedStartTime(), task.getEndTime());
} else {
logger.warn("Datafeed [{}] was closed while being opened", task.getDatafeedId());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use the terms “started” and “stopped” with datafeeds instead of “opened” and “closed”, so please could you change those two words in this message.

}
}
}

Expand Down