1u0 commented on a change in pull request #9271: [FLINK-13384][1.9][runtime] 
Fix back pressure sampling for SourceStreamTask
URL: https://github.com/apache/flink/pull/9271#discussion_r309742123
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java
 ##########
 @@ -593,6 +593,10 @@ else if (current == ExecutionState.CANCELING) {
                        LOG.info("Loading JAR files for task {}.", this);
 
                        userCodeClassLoader = createUserCodeClassloader();
+
+                       // make sure the user code classloader is accessible 
thread-locally
+                       
executingThread.setContextClassLoader(userCodeClassLoader);
 
 Review comment:
   **Update:** it looks like that in this context (`Task::doRun()`) 
`executingThread` is supposed to be the same as `Thread.currentThread()`.
   What about changing 
`executingThread.setContextClassLoader(userCodeClassLoader)` to 
`Thread.currentThread().setContextClassLoader(userCodeClassLoader)` just before
   ```
   invokable = loadAndInstantiateInvokable(...);
   ```
   ?
   This also may help some tests, that call `Task.run()` directly.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to