You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/07/07 06:42:16 UTC

[GitHub] [spark] Ngone51 edited a comment on pull request #28850: [SPARK-32015][Core]Remote inheritable thread local variables after spark context is stopped

Ngone51 edited a comment on pull request #28850:
URL: https://github.com/apache/spark/pull/28850#issuecomment-654633882


   I agree with @srowen and think the latest update is still too hacky.
   
   I'm thinking about another way that we might avoid passing `activeThreadSession` to threads that are out of Spark by overriding `InheritableThreadLocal.childValue`. We could determine the thread by checking thread's stack trace, e.g:
   
   ```
   private val activeThreadSession = new InheritableThreadLocal[SparkSession] {
     override def childValue(parentValue: Int): Int = {
         // note the current thread is still the parent thread but we could
         // know whether it's creating an internal Spark thread by checking 
         // the thread's initialization stack trace.
         if (isWithinSpark(Thread.currentThread)) {
           parentValue
         } else {
          null
        }
     }
   }
   ```
   
   WDYT?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org