You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-dev@hadoop.apache.org by "Todd Lipcon (JIRA)" <ji...@apache.org> on 2009/07/30 01:55:14 UTC

[jira] Created: (HDFS-513) NameNode.getBlockLocations throws NPE when offset > filesize and file is not empty

NameNode.getBlockLocations throws NPE when offset > filesize and file is not empty
----------------------------------------------------------------------------------

                 Key: HDFS-513
                 URL: https://issues.apache.org/jira/browse/HDFS-513
             Project: Hadoop HDFS
          Issue Type: Bug
          Components: name-node
            Reporter: Todd Lipcon


in BlockManager.getBlockLocations, if the offset is past the end of a non-empty file, it returns null. In FSNamesystem.getBlockLocationsInternal, this null is passed through to inode.createLocatedBlocks, so it ends up with a LocatedBlocks instance whose .blocks is null. This is then iterated over in FSNamesystem.getBlockLocations, and throws an NPE.

Instead, I think BlockManager.getBlockLocations should return Collections.emptyList in the past-EOF case. This would result in an empty list response from NN.getBlockLocations which matches the behavior of an empty file. If this sounds like the appropriate fix I"ll attach the patch.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.