Skip to content

HDDS-15013. gRPC channel holding objects on completed request in ReadBlock#10071

Merged
jojochuang merged 1 commit intoapache:masterfrom
ss77892:HDDS-15013
Apr 13, 2026
Merged

HDDS-15013. gRPC channel holding objects on completed request in ReadBlock#10071
jojochuang merged 1 commit intoapache:masterfrom
ss77892:HDDS-15013

Conversation

@ss77892
Copy link
Copy Markdown
Contributor

@ss77892 ss77892 commented Apr 11, 2026

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.

@ss77892 ss77892 changed the title HDDS-15013 gRPC channel holding objects on completed request in ReadBlock HDDS-15013. gRPC channel holding objects on completed request in ReadBlock Apr 11, 2026
Copy link
Copy Markdown

@yandrey321 yandrey321 left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 via ClientCallStreamObserver.onCompleted(), with fallback to cancel(...) if completion throws.
  • Extend TestStreamBlockInputStream to 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.

Comment on lines +235 to +236
final StreamingReader reader = streamingReader;
streamingReader = null;
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.

this is unnecessary since the method is synchronized. Can simply update streamingReader = null at the end.

@jojochuang jojochuang merged commit 3daabc8 into apache:master Apr 13, 2026
49 checks passed
@jojochuang
Copy link
Copy Markdown
Contributor

Merged. Thanks @ss77892 @yandrey321

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.

4 participants