Sanjay Malakar created HDFS-17978:
-------------------------------------
Summary: Ensure requestShortCircuitFdsForRead() closes the block
stream when metadata-stream setup fails
Key: HDFS-17978
URL: https://issues.apache.org/jira/browse/HDFS-17978
Project: Hadoop HDFS
Issue Type: Bug
Components: datanode
Affects Versions: 3.4.1
Reporter: Sanjay Malakar
{\{org.apache.hadoop.hdfs.server.datanode.DataNode.requestShortCircuitFdsForRead()}}
opens the block data stream into \{{fis[0]}} before opening the metadata
stream into \{{fis[1]}}. \{{DatanodeUtil.getMetaDataInputStream()}} (and
\{{checkStorageState}} / \{{getBlockInputStream}}) can throw
\{{{}java.io.IOException{}}}. The catch clause handles only
\{{java.lang.ClassCastException}}, so the \{{java.io.IOException}} propagates
with \{{fis[0]}} already open. The \{{fis}} array is never returned on that
path, so \{{fis[0]}} is leaked.
{\{requestShortCircuitFdsForRead()}} should close any stream already stored in
\{{fis}} before propagating the \{{java.io.IOException}}.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]