ibzib commented on pull request #13722:
URL: https://github.com/apache/beam/pull/13722#issuecomment-760359405


   > LGTM but we should come up with a way to avoid these leaks by shutting 
down GRPC resources properly. It may be difficult due to the way GRPC keeps 
static thread pools. Luckily, Flink 1.12 onwards recycles classloaders, so it 
will be less of a problem.
   
   It seems the context classloader is sometimes set to 
`SafetyNetWrapperClassLoader` instead of `AppClassLoader` like it should be. 
This is nondeterministic but usually happens. I found the stale context 
classloader is set in the thread that runs `JobInvocation.start`, which is 
inherited by the child thread that runs `runPipeline`. 
https://github.com/apache/beam/blob/17fbe8be70b71bc1236e553a5fe7902a2df5dda4/runners/java-job-service/src/main/java/org/apache/beam/runners/jobsubmission/JobInvocation.java#L90
   I chased this bug for a while but couldn't figure out exactly why this is 
happening. How would GRPC's static thread pools cause the class loader to leak?


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


Reply via email to