[CELEBORN-2253][0.6] Fix IndexOutOfBoundsException reading shuffle data from HDFS#3697
Closed
pan3793 wants to merge 1 commit into
Closed
[CELEBORN-2253][0.6] Fix IndexOutOfBoundsException reading shuffle data from HDFS#3697pan3793 wants to merge 1 commit into
pan3793 wants to merge 1 commit into
Conversation
SteNicholas
approved these changes
May 21, 2026
SteNicholas
pushed a commit
that referenced
this pull request
May 21, 2026
…ta from HDFS Backport CELEBORN-2253 (#3683) to branch-0.6, code and tests are tuned to adapt branch-0.6 due to miss CELEBORN-2211 (#3548) Assisted-by: OpenCode:mimo-v2.5-pro --- Original PR description. ### What changes were proposed in this pull request? `HdfsFlushTask.writeAndRecordMetrics` calls `hdfsStream.write(bytes)`, which writes the full `bytes.length`. When the provider passes a reusable `copyBytes` buffer (whose length is `>= size`), this leaks trailing bytes from previous flushes into the current partition file. Pass the actual readable size to write only `size` bytes. ### Why are the changes needed? The S3 and OSS flush paths had the same bug and were fixed in #3600 for CELEBORN-2263; the HDFS path was missed. Without the fix, shuffle data flushed to HDFS can be corrupted when `copyBytes` is reused across flushes, and readers later fail with `IndexOutOfBoundsException` in `CelebornInputStream.fillBuffer`, for example: ``` IndexOutOfBoundsException: readerIndex(4154253) + length(808530018) exceeds writerIndex(12457470) ``` ### Does this PR resolve a correctness bug? Yes. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? New unit test in `FlushTaskSuite` mirrors the S3/OSS coverage added in #3600. It drives `HdfsFlushTask.flush` with `copyBytes` arrays of three sizes (equal, larger, smaller than the buffer payload), captures the `FSDataOutputStream.write` arguments via Mockito's `ArgumentCaptor`, and asserts the offset/length pair matches the buffer content. The test fails on master with `ArgumentsAreDifferent` at `FlushTask.scala:128` and passes with the fix. Closes #3697 from pan3793/CELEBORN-2253-0.6. Authored-by: Cheng Pan <chengpan@apache.org> Signed-off-by: SteNicholas <programgeek@163.com>
Member
|
Thanks. Merged to branch-0.6(v0.6.4). |
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.
Backport CELEBORN-2253 (#3683) to branch-0.6, code and tests are tuned to adapt branch-0.6 due to miss CELEBORN-2211 (#3548)
Assisted-by: OpenCode:mimo-v2.5-pro
Original PR description.
What changes were proposed in this pull request?
HdfsFlushTask.writeAndRecordMetricscallshdfsStream.write(bytes), which writes the fullbytes.length. When the provider passes a reusablecopyBytesbuffer (whose length is>= size), this leaks trailing bytes from previous flushes into the current partition file. Pass the actual readable size to write onlysizebytes.Why are the changes needed?
The S3 and OSS flush paths had the same bug and were fixed in #3600 for CELEBORN-2263; the HDFS path was missed. Without the fix, shuffle data flushed to HDFS can be corrupted when
copyBytesis reused across flushes, and readers later fail withIndexOutOfBoundsExceptioninCelebornInputStream.fillBuffer, for example:Does this PR resolve a correctness bug?
Yes.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
New unit test in
FlushTaskSuitemirrors the S3/OSS coverage added in #3600. It drivesHdfsFlushTask.flushwithcopyBytesarrays of three sizes (equal, larger, smaller than the buffer payload), captures theFSDataOutputStream.writearguments via Mockito'sArgumentCaptor, and asserts the offset/length pair matches the buffer content. The test fails on master withArgumentsAreDifferentatFlushTask.scala:128and passes with the fix.