HDDS-14860. Synchronize ThrottledAsyncChecker#schedule#9948
Merged
adoroszlai merged 1 commit intoapache:masterfrom Mar 19, 2026
Conversation
… ensure thread safety.
Contributor
|
Thanks @ptlrs for the patch. I think you missed this PR raised by @ChenSammi which seems to be duplicated here . |
jojochuang
approved these changes
Mar 19, 2026
Contributor
jojochuang
left a comment
There was a problem hiding this comment.
Looks good. Checked the whole class, no other methods require synchronizations.
Contributor
|
Thanks @ptlrs for the patch, @Gargi-jais11, @jojochuang for the review, @ChenSammi for also submitting a patch for the same problem. |
Contributor
Author
|
Thanks for the patch @ChenSammi. I didn't see that you had also created a PR until @Gargi-jais11 pointed it out. Thanks for the reviews @Gargi-jais11 @jojochuang @adoroszlai |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
ThrottledAsyncChecker#schedulehas two preconditions:Is a check already in progress
Was the previous check completed a long time ago
If both of these conditions are satisfied then a new check is scheduled.
However, consider a case where a check was never run or it was run a long time ago. This situation will satisfy both the preconditions. Now if two threads call the same schedule method for the same target/volume, there will be a race condition and/or undefined behavior.
This is because the
checksInProgressmap is updated only towards the end of the method.We cannot simply update the
checksInProgressat the start of the method as we need theListenableFutureavailable before we update that map.What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-14860
How was this patch tested?
CI: https://github.com/ptlrs/ozone/actions/runs/23265982507