HDDS-15698. Intermittent outOfBounds in testConcurrentWriteHSync #10830
Open
navinko wants to merge 2 commits into
Open
HDDS-15698. Intermittent outOfBounds in testConcurrentWriteHSync #10830navinko wants to merge 2 commits into
navinko wants to merge 2 commits into
Conversation
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?
This PR fixes the TestHSync#testConcurrentWriteHSync, Intermittent IndexOutOfBoundsException due to concurrent write() and hsync() calls. I tried fixing the actual code instaed of test case.
This bug was caused by concurrent write() and hsync() access to the same block pool state.
streamEntries and currentStreamIndex must be read and updated together, but they were not protected as one atomic unit, so getCurrentStreamEntry() could sometimes see a stale index and throw IndexOutOfBoundsException.
I fixed this by synchronizing the pool methods that read or change this shared state.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-15698
How was this patch tested?
I ran in my fork branch - flaky-test-check workflow, twice for each using master and HDDS-15698 feature branch with my git hash #29e2d3c41cf69f57bf2ad296d7866468b1263411
https://github.com/navinko/ozone/actions/runs/29763317683
https://github.com/navinko/ozone/actions/runs/29691033247
https://github.com/navinko/ozone/actions/runs/29716260437
https://github.com/navinko/ozone/actions/runs/29744590973
Successful CI- https://github.com/navinko/ozone/actions/runs/28710748833