Skip to content

HDDS-15698. Intermittent outOfBounds in testConcurrentWriteHSync #10830

Open
navinko wants to merge 2 commits into
apache:masterfrom
navinko:HDDS-15698
Open

HDDS-15698. Intermittent outOfBounds in testConcurrentWriteHSync #10830
navinko wants to merge 2 commits into
apache:masterfrom
navinko:HDDS-15698

Conversation

@navinko

@navinko navinko commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

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.

  • writer and hsync threads are both active at the same time
  • hsync() reaches KeyOutputStream.handleFlushOrClose(...)
  • that calls BlockOutputStreamEntryPool.getCurrentStreamEntry()
  • if pool state changes in the middle, we get IndexOutOfBoundsException

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

Successful CI- https://github.com/navinko/ozone/actions/runs/28710748833

@navinko navinko changed the title Hdds 15698 HDDS-15698. Intermittent outOfBounds in testConcurrentWriteHSync Jul 21, 2026

@chihsuan chihsuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the patch! @navinko LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants