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.

Reply via email to