FSNamesystem.countNodes(Block b) should be synchronized.
--------------------------------------------------------

                 Key: HADOOP-4972
                 URL: https://issues.apache.org/jira/browse/HADOOP-4972
             Project: Hadoop Core
          Issue Type: Bug
          Components: dfs
            Reporter: Tsz Wo (Nicholas), SZE


(Copied a 
[comment|https://issues.apache.org/jira/browse/HADOOP-4840?focusedCommentId=12657242#action_12657242]
 from HADOOP-4840.)

FSNamesystem.countNodes(..) is called in many places including:

    * FSNamesystem.addStoredBlock(Block, DatanodeDescriptor, DatanodeDescriptor)
    * FSNamesystem.checkReplicationFactor(INodeFile)
    * FSNamesystem.decrementSafeBlockCount(Block)
    * FSNamesystem.getBlockLocationsInternal(String, INodeFile, long, long, 
int, boolean)
    * FSNamesystem.invalidateBlock(Block, DatanodeInfo)
    * FSNamesystem.isReplicationInProgress(DatanodeDescriptor)
    * FSNamesystem.markBlockAsCorrupt(Block, DatanodeInfo)
    * FSNamesystem.processMisReplicatedBlocks()
    * FSNamesystem.processPendingReplications()
    * FSNamesystem.updateNeededReplications(Block, int, int)

However, some of them, e.g. getBlockLocationsInternal, call countNodes(..) 
without owning the fsnamesystem lock before calling . It may causes NPE in 
runtime.

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