Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-21292

IdLock.getLockEntry() may hang if interrupted

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.0.0, 2.2.0, 2.1.1, 2.0.3
    • Component/s: None
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      This is a rare case found by my colleague which really happened on our production env.
      Thread may hang(or enter a infinite loop ) when try to call IdLock.getLockEntry(). Here is the case:
      1. Thread1 owned the IdLock, while Thread2(the only one waiting) was waiting for it.
      2. Thread1 called releaseLockEntry, it will set IdLock.locked = false, but since Thread2 was waiting, it won't call map.remove(entry.id)
      3. While Thread1 was calling releaseLockEntry, Thread2 was interrupted. So no one will remove this IdLock from the map.
      4. If another thread try to call getLockEntry on this IdLock´╝î it will end up in a infinite loop. Since existing = map.putIfAbsent(entry.id, entry)) != null and existing.locked=false

      It is hard to write a UT since it is a very rare race condition.

        Attachments

          Activity

            People

            • Assignee:
              allan163 Allan Yang
              Reporter:
              allan163 Allan Yang
            • Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: