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

Unreleased volume references cause an infinite loop

    XMLWordPrintableJSON

Details

    • Reviewed

    Description

      When BlockSender throws an exception because the meta-data cannot be found, the volume reference obtained by the thread is not released, which causes the thread trying to remove the volume to wait and fall into an infinite loop.

      boolean checkVolumesRemoved() {
        Iterator<FsVolumeImpl> it = volumesBeingRemoved.iterator();
        while (it.hasNext()) {
          FsVolumeImpl volume = it.next();
          if (!volume.checkClosed()) {
            return false;
          }
          it.remove();
        }
        return true;
      }
      
      boolean checkClosed() {
        // always be true.
        if (this.reference.getReferenceCount() > 0) {
          FsDatasetImpl.LOG.debug("The reference count for {} is {}, wait to be 0.",
              this, reference.getReferenceCount());
          return false;
        }
        return true;
      }
      

      At the same time, because the thread has been holding checkDirsLock when removing the volume, other threads trying to acquire the same lock will be permanently blocked.
      Similar problems also occur in RamDiskAsyncLazyPersistService and FsDatasetAsyncDiskService.
      This patch releases the three previously unreleased volume references.

      Attachments

        1. HDFS-15963.001.patch
          18 kB
          Shuyan Zhang
        2. HDFS-15963.002.patch
          17 kB
          Shuyan Zhang
        3. HDFS-15963.003.patch
          16 kB
          Shuyan Zhang

        Issue Links

          Activity

            People

              zhangshuyan Shuyan Zhang
              zhangshuyan Shuyan Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 5h 10m
                  5h 10m