[
https://issues.apache.org/jira/browse/ORC-653?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
dzcxzl resolved ORC-653.
------------------------
Resolution: Fixed
> OrcFile#getStaticMemoryManager caches initial configuration and leaks
> classloaders
> ----------------------------------------------------------------------------------
>
> Key: ORC-653
> URL: https://issues.apache.org/jira/browse/ORC-653
> Project: ORC
> Issue Type: Improvement
> Affects Versions: 1.5.6
> Reporter: Arvid Heise
> Priority: Major
>
> As part of our effort to find classloader leaks in Apache Flink, we found the
> following issue coming from OrcFile.
> {code:java}
> private static synchronized MemoryManager getStaticMemoryManager(
> final Configuration conf) {
> if (memoryManager == null) {
> memoryManager = new ThreadLocal<MemoryManager>() {
> @Override
> protected MemoryManager initialValue() {
> return new MemoryManagerImpl(conf);
> }
> };
> }
> return memoryManager.get();
> }
> {code}
> Here the original conf will be used for all other memory managers in the
> future. If you close the classloader of that conf, future usages of any
> {{MemoryManager}} coming through that {{ThreadLocal}} will fail.
> For our use case, where there is only one conf/{{MemoryManager}} per Thread,
> it would be sufficient, to explicitly initialize the thread locals.
> {code:java}
> private static synchronized MemoryManager getStaticMemoryManager(
> final Configuration conf) {
> MemoryManager manager = memoryManager.get();
> if (manager == null) {
> manager = new MemoryManagerImpl(conf);
> memoryManager.set(manager);
> }
> return manager;
> }
> {code}
> I can provide a patch and additional information.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)