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

Configuration#updatingResource/finalParameters are not thread-safe

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.6.0
    • Fix Version/s: 2.7.0
    • Component/s: conf
    • Labels:
      None
    • Target Version/s:
    • Hadoop Flags:
      Reviewed

      Description

      Configuration objects are not fully thread-safe, which causes problems in multi-threaded frameworks like Spark that use these configurations to interact with existing Hadoop APIs (such as InputFormats).

      SPARK-2546 is an example of a problem caused by this lack of thread-safety. In that bug, multiple concurrent modifications of the same Configuration (in third-party code) caused an infinite loop because Configuration's internal java.util.HashMap is not thread-safe.

      One workaround is for our code to clone Configuration objects; unfortunately, this also suffers from thread-safety issues on older Hadoop versions because Configuration's constructor wasn't thread-safe (HADOOP-10456).

      Looking at a recent version of Configuration.java, it seems that the private updatingResource HashMap and finalParameters HashSet fields the only non-thread-safe collections in Configuration (Java's Properties class is thread-safe), so I don't think that it would be hard to make Configuration fully thread-safe.

        Attachments

        1. HADOOP-11209.004.patch
          7 kB
          Varun Saxena
        2. HADOOP-11209.003.patch
          7 kB
          Varun Saxena
        3. HADOOP-11209.002.patch
          5 kB
          Varun Saxena
        4. HADOOP-11209.001.patch
          3 kB
          Varun Saxena

          Issue Links

            Activity

              People

              • Assignee:
                varun_saxena Varun Saxena
                Reporter:
                joshrosen Josh Rosen
              • Votes:
                1 Vote for this issue
                Watchers:
                12 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: