[ 
https://issues.apache.org/jira/browse/SPARK-10563?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrew Or updated SPARK-10563:
------------------------------
    Description: 
Currently, when a child thread inherits local properties from the parent 
thread, it gets a reference of the parent's local properties and uses them as 
default values.

The problem, however, is that when the parent changes the value of an existing 
property, the changes are reflected in the child thread! This has very 
confusing semantics, especially in streaming.

{code}
private val localProperties = new InheritableThreadLocal[Properties] {
  override protected def childValue(parent: Properties): Properties = new 
Properties(parent)
  override protected def initialValue(): Properties = new Properties()
}
{code}

Instead, we should make a clone of the parent properties rather than passing in 
a mutable reference.

  was:
Currently, when a child thread inherits local properties from the parent 
thread, it gets a reference of the parent's local properties and uses them as 
default values.

The problem, however, is that when the parent changes the value of an existing 
property, the changes are reflected in the child thread! This has very 
confusing semantics, especially in streaming.

{code}
  private val localProperties = new InheritableThreadLocal[Properties] {
    override protected def childValue(parent: Properties): Properties = new 
Properties(parent)
    override protected def initialValue(): Properties = new Properties()
  }
{code}

Instead, we should make a clone of the parent properties rather than passing in 
a mutable reference.


> SparkContext's local properties should be cloned when inherited
> ---------------------------------------------------------------
>
>                 Key: SPARK-10563
>                 URL: https://issues.apache.org/jira/browse/SPARK-10563
>             Project: Spark
>          Issue Type: Bug
>          Components: Spark Core
>    Affects Versions: 1.0.0
>            Reporter: Andrew Or
>            Assignee: Andrew Or
>
> Currently, when a child thread inherits local properties from the parent 
> thread, it gets a reference of the parent's local properties and uses them as 
> default values.
> The problem, however, is that when the parent changes the value of an 
> existing property, the changes are reflected in the child thread! This has 
> very confusing semantics, especially in streaming.
> {code}
> private val localProperties = new InheritableThreadLocal[Properties] {
>   override protected def childValue(parent: Properties): Properties = new 
> Properties(parent)
>   override protected def initialValue(): Properties = new Properties()
> }
> {code}
> Instead, we should make a clone of the parent properties rather than passing 
> in a mutable reference.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to