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_r309700136
 
 

 ##########
 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:
   Imo, the issue with class loader is happening to the change that introduced 
in this PR.
   
   This happens, because you are eagerly creating `LegacySourceFunctionThread` 
and it inherits 
   default class loader. So to fix your issue, you are either need to set class 
loader in `LegacySourceFunctionThread.run()` or on the thread that instantiates 
the `invokable`.
   
   Instead of setting the `userCodeClassLoader` eagerly, I propose to revert 
any changes related to it. You can instantiate the `LegacySourceFunctionThread` 
field reference in the `SourceStreamTask` later: 
    * as it was instantiated before in 
`SourceStreamTask::performDefaultAction()`;
    * or move the `LegacySourceFunctionThread` creation to 
`SourceStreamTask::init()`.

----------------------------------------------------------------
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