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
Attachments
Issue Links
- duplicates
-
HADOOP-11274 ConcurrentModificationException in Configuration Copy Constructor
- Closed
- is related to
-
SPARK-2546 Configuration object thread safety issue
- Resolved
-
HADOOP-11984 Enable parallel JUnit tests in pre-commit.
- Resolved