Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-8684

Deadlock between WritableComparator and WritableComparable

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.0.3, 3.0.0-alpha1
    • 0.23.4, 2.0.3-alpha
    • io
    • None
    • Reviewed

    Description

      Classes implementing WriableComparable in Hadoop call the method WritableComparator.define() in their static initializers. This means, the classes call the method define() while thier class loading, under locking their class objects. And, the method WritableComparator.define() locks the WritableComaprator class object.

      On the other hand, WritableComparator.get() also locks the WritableComparator class object, and the method may create instances of the targeted comparable class, involving loading the targeted comparable class if any. This means, the method might try to lock the targeted comparable class object under locking the WritableComparator class object.

      There are reversed orders of locking objects, and you might fall in deadlock.

      Attachments

        1. Hadoop-8684.patch
          2 kB
          Jing Zhao
        2. Hadoop-8684.patch
          3 kB
          Jing Zhao
        3. Hadoop-8684.patch
          3 kB
          Jing Zhao
        4. Hadoop-8684.patch
          3 kB
          Jing Zhao
        5. Hadoop-8684.patch
          3 kB
          Jing Zhao
        6. WritableComparatorDeadLockTestApp.java
          2 kB
          Hiroshi Ikeda

        Activity

          People

            jingzhao Jing Zhao
            ikeda Hiroshi Ikeda
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: