hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eli Collins (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HDFS-3883) DFSClient NPE due to missing block when opening a file
Date Sat, 01 Sep 2012 01:44:07 GMT
Eli Collins created HDFS-3883:

             Summary: DFSClient NPE due to missing block when opening a file
                 Key: HDFS-3883
                 URL: https://issues.apache.org/jira/browse/HDFS-3883
             Project: Hadoop HDFS
          Issue Type: Bug
          Components: hdfs client
    Affects Versions: 1.0.0
            Reporter: Eli Collins
            Assignee: Eli Collins
            Priority: Minor

I saw the following NPE for a client on branch-1 that looks like it accessed a block not in
the volume map, probably because the block was already deleted (otherwise the primary should
have a block file). We should throw an IOE in this case.

Block newBlock = primary.getBlockInfo(last.getBlock());
long newBlockSize = newBlock.getNumBytes();    <--------

>From getBlockInfo to getStoredBlock..
  public synchronized Block getStoredBlock(long blkid) throws IOException {
    File blockfile = findBlockFile(blkid);
    if (blockfile == null) {
      return null;

Digging into findBlockFile..
  public synchronized File findBlockFile(long blockId) {
    final Block b = new Block(blockId);
    File blockfile = null;
    ActiveFile activefile = ongoingCreates.get(b);
    if (activefile != null) {
      blockfile = activefile.file;
    if (blockfile == null) {
      blockfile = getFile(b);
    if (blockfile == null) {
      if (DataNode.LOG.isDebugEnabled()) {
        DataNode.LOG.debug("ongoingCreates=" + ongoingCreates);
        DataNode.LOG.debug("volumeMap=" + volumeMap);
    return blockfile;

Into getFile..
  public synchronized File getFile(Block b) {
    DatanodeBlockInfo info = volumeMap.get(b);
    if (info != null) {
      return info.getFile();
    return null;

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

View raw message