yittg commented on pull request #3797:
URL: https://github.com/apache/iceberg/pull/3797#issuecomment-1003249667
@rdblue The context of thread in ThreadPool inherited from the parent
thread. For the first task of one thread, the parent thread is current thread
that executes the task, so the context is consistent with where the task is
executed. As of the second and following tasks, the context of the existing
thread running the task is still the one that started the thread, which can be
different from the one that executed the task. And this can cause the context
class loader issue described in #3776 .
For example:
1. Thread[A] with Context[Ca] executes Task[T1];
2. ThreadPool starts new Thread[P1] with Context[Ca], and running Task[T1],
(OK);
3. Thread[B] with Context[Cb] executes Task[T2];
4. ThreadPool using Thread[P1] with Context[Ca] to run the Task[T2], (not
OK);
> Context[Ca] can be different from Context[Cb] and maybe already
expired now.
This change records the context that executes one task in the wrapper
Runnable, and sets it to the target thread before actually running the task.
This can make sure the consistency of the context.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]