Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-4380

Opening a file for read before writer writes a block causes NPE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.0.3
    • None
    • None
    • None

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              tlipcon Todd Lipcon
              Votes:
              1 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated: