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

Read lock must be released before acquiring a write lock

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 0.23.0
    • 0.23.0
    • None
    • None

    Description

      In FSNamesystem.getBlockLocationsUpdateTimes function, we have the following code:

          for (int attempt = 0; attempt < 2; attempt++) {
            if (attempt == 0) { // first attempt is with readlock
              readLock();
            }  else { // second attempt is with  write lock
              writeLock(); // writelock is needed to set accesstime
            }
      
            ...
      
            if (attempt == 0) {
               continue;
            }
      

      In the above code, readLock is acquired in attempt 0 and if the execution enters in the continue block, then it tries to acquire writeLock before releasing the readLock.

      Attachments

        Activity

          People

            bharathm Bharath Mundlapudi
            bharathm Bharath Mundlapudi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: