You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by "Josh Rosen (JIRA)" <ji...@apache.org> on 2014/10/17 23:39:33 UTC
[jira] [Created] (HADOOP-11209) Configuration is not thread-safe
Josh Rosen created HADOOP-11209:
-----------------------------------
Summary: Configuration is not thread-safe
Key: HADOOP-11209
URL: https://issues.apache.org/jira/browse/HADOOP-11209
Project: Hadoop Common
Issue Type: Bug
Components: conf
Reporter: Josh Rosen
{{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|https://github.com/apache/hadoop/blob/d989ac04449dc33da5e2c32a7f24d59cc92de536/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java#L666], 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.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)