You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "rich7420 (via GitHub)" <gi...@apache.org> on 2025/11/16 12:20:19 UTC
[PR] HDDS 13939: Potential channel leak in StreamingClient.stream() method [ozone]
rich7420 opened a new pull request, #9304:
URL: https://github.com/apache/ozone/pull/9304
## What changes were proposed in this pull request?
This PR fixes a potential resource leak in `StreamingClient.stream()` where Netty channels may not be properly closed in timeout or exception scenarios. The fix ensures channels are always closed in a `finally` block and adds proper timeout handling.
## What is the link to the Apache JIRA
[HDDS-13939](https://issues.apache.org/jira/browse/HDDS-13939)
## How was this patch tested?
https://github.com/rich7420/ozone/actions/runs/19404511402
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-13939. Potential channel leak in StreamingClient.stream() method [ozone]
Posted by "rich7420 (via GitHub)" <gi...@apache.org>.
rich7420 commented on PR #9304:
URL: https://github.com/apache/ozone/pull/9304#issuecomment-3544169009
@szetszwo thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS 13939. Potential channel leak in StreamingClient.stream() method [ozone]
Posted by "szetszwo (via GitHub)" <gi...@apache.org>.
szetszwo commented on code in PR #9304:
URL: https://github.com/apache/ozone/pull/9304#discussion_r2532269951
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/stream/StreamingClient.java:
##########
@@ -86,11 +86,17 @@ public void stream(String id) {
}
public void stream(String id, long timeout, TimeUnit unit) {
+ Channel channel = null;
try {
- Channel channel = bootstrap.connect(host, port).sync().channel();
- channel.writeAndFlush(id + "\n")
- .await(timeout, unit);
- channel.closeFuture().await(timeout, unit);
+ channel = bootstrap.connect(host, port).sync().channel();
+ boolean writeSuccess = channel.writeAndFlush(id + "\n").await(timeout, unit);
+ if (!writeSuccess) {
+ throw new StreamingException("Write operation timed out");
Review Comment:
Let's include more information in the error message
```java
"Failed to write id " + id + ": timed out " + timeout + " " + unit
```
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/stream/StreamingClient.java:
##########
@@ -86,11 +86,17 @@ public void stream(String id) {
}
public void stream(String id, long timeout, TimeUnit unit) {
+ Channel channel = null;
try {
- Channel channel = bootstrap.connect(host, port).sync().channel();
- channel.writeAndFlush(id + "\n")
- .await(timeout, unit);
- channel.closeFuture().await(timeout, unit);
+ channel = bootstrap.connect(host, port).sync().channel();
+ boolean writeSuccess = channel.writeAndFlush(id + "\n").await(timeout, unit);
+ if (!writeSuccess) {
+ throw new StreamingException("Write operation timed out");
+ }
+ boolean closeSuccess = channel.closeFuture().await(timeout, unit);
+ if (!closeSuccess) {
+ throw new StreamingException("Close operation timed out");
Review Comment:
Similarly,
```java
"Failed to close channel for id " + id + ": timed out " + timeout + " " + unit
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS 13939. Potential channel leak in StreamingClient.stream() method [ozone]
Posted by "rich7420 (via GitHub)" <gi...@apache.org>.
rich7420 commented on PR #9304:
URL: https://github.com/apache/ozone/pull/9304#issuecomment-3539578059
@szetszwo thanks for the review! I'll fix it as soon as possible.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-13939. Potential channel leak in StreamingClient.stream() method [ozone]
Posted by "szetszwo (via GitHub)" <gi...@apache.org>.
szetszwo merged PR #9304:
URL: https://github.com/apache/ozone/pull/9304
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org