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

Race condition on yieldCount in FSDirectory.java

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Won't Fix
    • 2.7.0
    • None
    • namenode
    • None

    Description

      getContentSummaryInt only held read lock, and it called fsd.addYieldCount which may cause race condition:

        private static ContentSummary getContentSummaryInt(FSDirectory fsd,
            INodesInPath iip) throws IOException {
          fsd.readLock();
          try {
            INode targetNode = iip.getLastINode();
            if (targetNode == null) {
              throw new FileNotFoundException("File does not exist: " + iip.getPath());
            }
            else {
              // Make it relinquish locks everytime contentCountLimit entries are
              // processed. 0 means disabled. I.e. blocking for the entire duration.
              ContentSummaryComputationContext cscc =
                  new ContentSummaryComputationContext(fsd, fsd.getFSNamesystem(),
                      fsd.getContentCountLimit(), fsd.getContentSleepMicroSec());
              ContentSummary cs = targetNode.computeAndConvertContentSummary(cscc);
              fsd.addYieldCount(cscc.getYieldCount());
              return cs;
            }
          } finally {
            fsd.readUnlock();
          }
        }
      

      Attachments

        1. HDFS-9054.patch
          2 kB
          yunjiong zhao

        Activity

          People

            zhaoyunjiong yunjiong zhao
            zhaoyunjiong yunjiong zhao
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: