W-dragan commented on issue #4915: URL: https://github.com/apache/seatunnel/issues/4915#issuecomment-1983044507
[classloader.txt](https://github.com/apache/seatunnel/files/14521620/classloader.txt) org.apache.seatunnel.engine.server.service.classloader.DefaultClassLoaderService#getClassLoader @Override public synchronized ClassLoader getClassLoader(long jobId, Collection<URL> jars) { log.info("Get classloader for job {} with jars {}", jobId, jars); if (cacheMode) { // with cache mode, all jobs share the same classloader if the jars are the same jobId = 1L; } if (!classLoaderCache.containsKey(jobId)) { classLoaderCache.put(jobId, new ConcurrentHashMap<>()); classLoaderReferenceCount.put(jobId, new ConcurrentHashMap<>()); } Map<String, ClassLoader> classLoaderMap = classLoaderCache.get(jobId); String key = covertJarsToKey(jars); if (classLoaderMap.containsKey(key)) { log.info("use exist classloader for job {} with jars {}", jobId, jars); classLoaderReferenceCount.get(jobId).get(key).incrementAndGet(); return classLoaderMap.get(key); } else { ClassLoader classLoader = new SeaTunnelChildFirstClassLoader(jars); log.info("Create classloader for job {} with jars {}", jobId, jars); classLoaderMap.put(key, classLoader); classLoaderReferenceCount.get(jobId).put(key, new AtomicInteger(1)); return classLoader; } This is a part of the code that I have modified, mainly by changing the log level and adding logs to facilitate the analysis of which branch the code went to. Based on the above logs, I found that the classLoader caching mode was indeed enabled, and the logic for code branch entry was correct. However, the classLoader did continue to grow, 2024-03-07 17:00:35684 INFO org. apache. seatunnel. engine. common. loader ClassLoaderUtil - recycle classloader org.apache.seatunnel.engine.common.loader.SeaTunnelChildFirstClassLoader@7dc18237 Suspected to be recyclable @Hisoka-X -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
