Todd Lipcon created HDFS-4380:
---------------------------------

             Summary: Opening a file for read before writer writes a block 
causes NPE
                 Key: HDFS-4380
                 URL: https://issues.apache.org/jira/browse/HDFS-4380
             Project: Hadoop HDFS
          Issue Type: Bug
    Affects Versions: 1.0.3
            Reporter: Todd Lipcon


JD Cryans found this issue: it seems like, if you open a file for read 
immediately after it's been created by the writer, after a block has been 
allocated, but before the block is created on the DNs, then you can end up with 
the following NPE:

java.lang.NullPointerException
       at 
org.apache.hadoop.hdfs.DFSClient$DFSInputStream.updateBlockInfo(DFSClient.java:1885)
       at 
org.apache.hadoop.hdfs.DFSClient$DFSInputStream.openInfo(DFSClient.java:1858)
       at 
org.apache.hadoop.hdfs.DFSClient$DFSInputStream.<init>(DFSClient.java:1834)
       at org.apache.hadoop.hdfs.DFSClient.open(DFSClient.java:578)
       at 
org.apache.hadoop.hdfs.DistributedFileSystem.open(DistributedFileSystem.java:154)

This seems to be because {{getBlockInfo}} returns a null block when the DN 
doesn't yet have the replica. The client should probably either fall back to a 
different replica or treat it as zero-length.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to