Martijn Visser created FLINK-41566:
--------------------------------------

             Summary: SafetyNetWrapperClassLoader#close doesn't close JARs 
opened by getResourceAsStream
                 Key: FLINK-41566
                 URL: https://issues.apache.org/jira/browse/FLINK-41566
             Project: Flink
          Issue Type: Bug
          Components: Runtime / Task
            Reporter: Martijn Visser


{{SafetyNetWrapperClassLoader}} inherits {{getResourceAsStream}} from 
{{URLClassLoader}}, which registers the {{JarFile}} it opens to be closed in 
{{URLClassLoader#close}}. The wrapper's {{close()}} only closes the inner 
classloader and doesn't call {{super.close()}}, so that {{JarFile}} stays open, 
and a JAR rebuilt at the same path is read through it.

The wrapper is the user-code classloader with the default 
{{classloader.check-leaked-classloader: true}}, and {{Task}} sets it as the 
context classloader, so any library that reads a resource through it hits this. 
We should delegate {{getResourceAsStream}} to the inner classloader, or call 
{{super.close()}} in {{close()}}.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to