That's not possible because inherited primitive values are copied, not
shared. Clearing problematic values on thread creation should eliminate
this problem.

As to your idea as a design goal, that's also not desirable, because Java
thread pooling is implemented in a very surprising way. The standard Java
thread pool doesn't use a master thread to spawn new threads, instead
pooled worker threads run the pooling code. This means that there is no
specific relationship between parent and child threads other than the fact
of one spawning the other. Essentially a thread's parent thread is
completely arbitrary, and for that reason inherited clearing of values is
undesirable.

I can try to dig up the PR where the reasons for the current design were
explained to me. My idea was to implement explicit inheritable
and non inheritable local properties. At this point I'm not deep enough in
the issues to have a strong opinion on whether that's a good design, and I
for one would very much welcome your design ideas on this.

On Thursday, September 29, 2016, Grant Digby <dig...@gmail.com> wrote:

> Yeah that would work although I was worried that they used
> InheritableThreadLocal vs Threadlocal because they did want the child
> threads to inherit the parent's executionId, maybe to stop the child
> threads
> from kicking off their own queries whilst working for the parent. I think
> the fix would be to somehow ensure the child's execution.id was cleared
> when
> the parents is.
>
>
>
> --
> View this message in context: http://apache-spark-
> developers-list.1001551.n3.nabble.com/IllegalArgumentException-
> spark-sql-execution-id-is-already-set-tp19124p19145.html
> Sent from the Apache Spark Developers List mailing list archive at
> Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe e-mail: dev-unsubscr...@spark.apache.org <javascript:;>
>
>

-- 
Want to work at Handy? Check out our culture deck and open roles 
<http://www.handy.com/careers>
Latest news <http://www.handy.com/press> at Handy
Handy just raised $50m 
<http://venturebeat.com/2015/11/02/on-demand-home-service-handy-raises-50m-in-round-led-by-fidelity/>
 led 
by Fidelity

Reply via email to