[CELEBORN-2356] Fix NPE before null-check in handleChunkFetchRequest#3731
Open
afterincomparableyum wants to merge 1 commit into
Open
[CELEBORN-2356] Fix NPE before null-check in handleChunkFetchRequest#3731afterincomparableyum wants to merge 1 commit into
afterincomparableyum wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes a correctness bug in the worker fetch path where an unknown stream ID could trigger a NullPointerException before the intended ChunkFetchFailure response is sent.
Changes:
- Reorders the
streamState == nullguard inFetchHandler.handleChunkFetchRequestto run before dereferencingstreamState.buffers. - Adds a unit test that exercises chunk fetch for an unregistered stream and asserts a
ChunkFetchFailureresponse.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| worker/src/main/scala/org/apache/celeborn/service/deploy/worker/FetchHandler.scala | Moves the null-check ahead of buffer-type matching to avoid NPE and return ChunkFetchFailure correctly. |
| worker/src/test/java/org/apache/celeborn/service/deploy/worker/FetchHandlerSuiteJ.java | Adds coverage for the “unregistered stream chunk fetch” failure path. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
|
@afterincomparableyum, please take a look at above comments? |
Contributor
Author
|
I've addressed comments @SteNicholas |
SteNicholas
reviewed
Jun 29, 2026
SteNicholas
reviewed
Jun 29, 2026
SteNicholas
requested changes
Jun 29, 2026
getStreamState returns null for an unknown id. The streamState.buffers pattern match dereferences it before the null guard runs, throwing NullPointerException. The intended ChunkFetchFailure reply is unreachable. Here we should reorder null-check first, then compute storageMetrics.
e650c16 to
6494db0
Compare
Contributor
Author
|
Addressed comments @SteNicholas |
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?
getStreamState returns null for an unknown id. The streamState.buffers pattern match dereferences it before the null guard runs, throwing NullPointerException. The intended ChunkFetchFailure reply is unreachable. Here we should reorder null-check first, then compute storageMetrics.
Why are the changes needed?
To prevent potential NPEs.
Does this PR resolve a correctness bug?
Does this PR introduce any user-facing change?
How was this patch tested?
CI/CD Unit tests.