You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-issues@hadoop.apache.org by "Chris Nauroth (JIRA)" <ji...@apache.org> on 2013/04/16 02:16:16 UTC

[jira] [Commented] (HDFS-4701) race condition between block recovery and removal of block pool can cause block recovery thread to exit with NullPointerException

    [ https://issues.apache.org/jira/browse/HDFS-4701?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13632406#comment-13632406 ] 

Chris Nauroth commented on HDFS-4701:
-------------------------------------

The problem occurs in the code below in {{DataNode}}.  The last line is at risk for a {{NullPointerException}}, because the block pool ID may have already been removed from the {{BlockPoolManager}}.  In this case, the call to {{BlockPoolManager#get}} would return null.

{code}
  /** Recover a block */
  private void recoverBlock(RecoveringBlock rBlock) throws IOException {
    ExtendedBlock block = rBlock.getBlock();
    String blookPoolId = block.getBlockPoolId();
    DatanodeID[] datanodeids = rBlock.getLocations();
    List<BlockRecord> syncList = new ArrayList<BlockRecord>(datanodeids.length);
    int errorCount = 0;

    //check generation stamps
    for(DatanodeID id : datanodeids) {
      try {
        BPOfferService bpos = blockPoolManager.get(blookPoolId);
        DatanodeRegistration bpReg = bpos.bpRegistration;
{code}

                
> race condition between block recovery and removal of block pool can cause block recovery thread to exit with NullPointerException
> ---------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HDFS-4701
>                 URL: https://issues.apache.org/jira/browse/HDFS-4701
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: datanode
>    Affects Versions: 3.0.0
>            Reporter: Chris Nauroth
>
> I saw this happen once while shutting down a datanode: a NullPointerException thrown from a block recovery thread.

--
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