[
https://issues.apache.org/jira/browse/HADOOP-16295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16837748#comment-16837748
]
eBugs commented on HADOOP-16295:
--------------------------------
We are able to trigger this by hacking a uni test:
# Replace [the call to
FileUtil.replaceFile()|[https://github.com/apache/hadoop/blob/branch-3.1.2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/FileIoProvider.java#L533]]
in FileIoProvider.replaceFile() with a throw IOException statement.
# Replace [the call to
datanode.checkDiskErrorAsync()|[https://github.com/apache/hadoop/blob/branch-3.1.2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/FileIoProvider.java#L1064]]
in FileIoProvider.onFailure() with a throw RuntimeException statement.
# Run unit test
[TestFileAppend#testBreakHardlinksIfNeeded|[https://github.com/apache/hadoop/blob/branch-3.1.2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestFileAppend.java]]
# And you'll see that the RuntimeException is thrown, which means when
FileUtil.replaceFile() throws an IOException due to an interrupt, an
unnecessary disk check will be performed.
> FileUtil.replaceFile() throws an IOException when it is interrupted, which
> leads to an unnecessary disk check
> -------------------------------------------------------------------------------------------------------------
>
> Key: HADOOP-16295
> URL: https://issues.apache.org/jira/browse/HADOOP-16295
> Project: Hadoop Common
> Issue Type: Sub-task
> Reporter: eBugs
> Priority: Minor
>
> Dear Hadoop developers, we are developing a tool to detect exception-related
> bugs in Java. Our prototype has spotted the following {{throw}} statement
> whose exception class and error message indicate different error conditions.
>
> Version: Hadoop-3.1.2
> File:
> HADOOP-ROOT/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileUtil.java
> Line: 1387
> {code:java}
> throw new IOException("replaceFile interrupted.");{code}
>
> An {{IOException}} can mean many different errors, while the error message
> indicates that {{replaceFile()}} is interrupted. This mismatch could be a
> problem. For example, the callers trying to handle other {{IOException}} may
> accidentally (and incorrectly) handle the interrupt. An
> {{InterruptedIOException}} may be better here.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]