You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-issues@hadoop.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2026/09/09 00:21:00 UTC
[jira] [Commented] (HDFS-17979) TeeOutputStream.close() should close every wrapped output
[ https://issues.apache.org/jira/browse/HDFS-17979?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18113073#comment-18113073 ]
ASF GitHub Bot commented on HDFS-17979:
---------------------------------------
iamsanjaymalakar opened a new pull request, #8732:
URL: https://github.com/apache/hadoop/pull/8732
### Problem
The OfflineEditsViewer `org.apache.hadoop.hdfs.tools.offlineEditsViewer.TeeOutputStream.close()` closes its wrapped output streams in a for-each loop. If one `java.io.OutputStream.close()` call throws `java.io.IOException`, the loop exits and every later output is left open.
### Change
* `close()` attempts every wrapped output.
* It keeps the first `java.io.IOException`.
* Later close failures are attached as suppressed exceptions.
* The first exception is thrown after every output has been attempted.
* `write()` and `flush()` are untouched.
### Testing
* `mvn -pl hadoop-hdfs-project/hadoop-hdfs -am -Dtest=TestTeeOutputStream test`
* New test `TestTeeOutputStream#testCloseAttemptsEveryOutput`: two of three wrapped streams throw on `close()`; the test asserts every stream is closed, the first exception is rethrown, and the second is suppressed. Fails against the previous code.
> TeeOutputStream.close() should close every wrapped output
> ---------------------------------------------------------
>
> Key: HDFS-17979
> URL: https://issues.apache.org/jira/browse/HDFS-17979
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: tools
> Affects Versions: 3.4.1
> Reporter: Sanjay Malakar
> Priority: Minor
>
> The OfflineEditsViewer \{{org.apache.hadoop.hdfs.tools.offlineEditsViewer.TeeOutputStream.close()}} closes its wrapped output streams in a for-each loop. If one \{{java.io.OutputStream.close()}} call throws \{{java.io.IOException}}, the loop exits and every later output is left open.
> {\{close()}} should attempt every output, keep the first \{{java.io.IOException}}, attach later failures as suppressed exceptions, and throw the first one after every output has been attempted. This mirrors the fix in ZOOKEEPER-5055 for \{{FileTxnLog.close()}}.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org