[ 
https://issues.apache.org/jira/browse/SPARK-20952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16035171#comment-16035171
 ] 

Andrew Ash commented on SPARK-20952:
------------------------------------

For the localProperties on SparkContext it does 2 things I can see to improve 
safety:

- first, it clones the properties for new threads so changes in the parent 
thread don't unintentionally affect a child thread: 
https://github.com/apache/spark/blob/v2.2.0-rc2/core/src/main/scala/org/apache/spark/SparkContext.scala#L330
- second, it clears the properties when they're no longer being used: 
https://github.com/apache/spark/blob/v2.2.0-rc2/core/src/main/scala/org/apache/spark/SparkContext.scala#L1942

Do we need to do do either the defensive cloning or the proactive clearing of 
taskInfos in executors like are done in the driver?

> TaskContext should be an InheritableThreadLocal
> -----------------------------------------------
>
>                 Key: SPARK-20952
>                 URL: https://issues.apache.org/jira/browse/SPARK-20952
>             Project: Spark
>          Issue Type: Bug
>          Components: Spark Core
>    Affects Versions: 2.1.1
>            Reporter: Robert Kruszewski
>            Priority: Minor
>
> TaskContext is a ThreadLocal as a result when you fork a thread inside your 
> executor task you lose the handle on the original context set by the 
> executor. We should change it to InheritableThreadLocal so we can access it 
> inside thread pools on executors. 
> See ParquetFileFormat#readFootersInParallel for example of code that uses 
> thread pools inside the tasks.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to