HDDS-15013. gRPC channel holding objects on completed request in ReadBlock#10071
Merged
jojochuang merged 1 commit intoapache:masterfrom Apr 13, 2026
Merged
HDDS-15013. gRPC channel holding objects on completed request in ReadBlock#10071jojochuang merged 1 commit intoapache:masterfrom
jojochuang merged 1 commit intoapache:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a gRPC client-stream lifecycle leak in StreamBlockInputStream by explicitly completing (and, on failure, cancelling) the request-side stream observer when the read stream is closed, preventing channels from retaining references to completed requests (HDDS-15013).
Changes:
- Update
StreamBlockInputStream.closeStream()to close the gRPC request stream viaClientCallStreamObserver.onCompleted(), with fallback tocancel(...)if completion throws. - Extend
TestStreamBlockInputStreamto verify request stream completion on EOF and correct cancel behavior when completion/cancel throw.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/StreamBlockInputStream.java | Completes/cancels the gRPC request observer on stream close to avoid retaining completed request objects. |
| hadoop-hdds/client/src/test/java/org/apache/hadoop/hdds/scm/storage/TestStreamBlockInputStream.java | Adds/updates unit tests to assert request observer completion and cancellation behavior under failure scenarios. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jojochuang
approved these changes
Apr 13, 2026
Comment on lines
+235
to
+236
| final StreamingReader reader = streamingReader; | ||
| streamingReader = null; |
Contributor
There was a problem hiding this comment.
this is unnecessary since the method is synchronized. Can simply update streamingReader = null at the end.
Contributor
|
Merged. Thanks @ss77892 @yandrey321 |
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?
Fixes a gRPC channel resource leak in StreamBlockInputStream where the request observer was not being properly closed on stream completion, causing channels to hold references to completed requests.
What is the link to the Apache JIRA
HDDS-15013
How was this patch tested?
HBase cluster with YCSB workload. UT.