hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Konstantin Shvachko (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-7606) Missing null check in INodeFile#getBlocks()
Date Fri, 16 Jan 2015 20:28:34 GMT

    [ https://issues.apache.org/jira/browse/HDFS-7606?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14280789#comment-14280789
] 

Konstantin Shvachko commented on HDFS-7606:
-------------------------------------------

Hi Chen you are absolutely right that as a general rule we as developers should do our best
in reproducing bugs and capturing them in unit tests in order to prevent ourselves and other
developers from making the same mistake again in the future.
In this particular case 
# I don't think that Ted had actually seen HDFS failing due to the NPE.
# I think it is an observation of a potential flaw based on examining the source code alone.
# And I don't think the NPE can be reproduced using any high level API calls to the NameNode.

In summary I don't think any reasonable test case can be written here.
It is just my opinion, and I very much hope this does not discourage you.
Your contributions to the project in this and other directions are very much welcome.

+1 on the latest patch.

> Missing null check in INodeFile#getBlocks()
> -------------------------------------------
>
>                 Key: HDFS-7606
>                 URL: https://issues.apache.org/jira/browse/HDFS-7606
>             Project: Hadoop HDFS
>          Issue Type: Bug
>    Affects Versions: 3.0.0
>            Reporter: Ted Yu
>            Assignee: Byron Wong
>            Priority: Minor
>         Attachments: HDFS-7606-1.patch, HDFS-7606.patch, HDFS-7606.patch
>
>
> {code}
>     BlockInfo[] snapshotBlocks = diff == null ? getBlocks() : diff.getBlocks();
>     if(snapshotBlocks != null)
>       return snapshotBlocks;
>     // Blocks are not in the current snapshot
>     // Find next snapshot with blocks present or return current file blocks
>     snapshotBlocks = getDiffs().findLaterSnapshotBlocks(diff.getSnapshotId());
> {code}
> If diff is null and snapshotBlocks is null, NullPointerException would result from the
call to diff.getSnapshotId().



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message