JarLoader appears to be holding onto the resource longer than necessary

Jayaprakash Arthanareeswaran jarthana at in.ibm.com
Tue Jul 5 11:39:17 UTC 2016



Hello,

Some of our new tests are hitting a case where JAR files appear to be kept
open. I am not sure where the issue lies as I can't access some of the
source code involved. I am attaching the stack trace at the end of the
mail.
We obtain the ServiceLoader with the following code where _procLoader is a
URLClassLoader.

			_serviceLoader = ServiceLoader.load(Processor.class,
_procLoader);
			_serviceLoaderIter = _serviceLoader.iterator();

This code has been like this for quite some time. Is this something recent?
Should we change something in our code? Please let me know if you need more
information.

Regards,
Jay

---------------------------------------------
Thread [main] (Suspended (breakpoint at line 198 in ZipFile))
	owns: URLClassPath  (id=3886)
	JarFile(ZipFile).<init>(File, int, Charset) line: 198
	JarFile(ZipFile).<init>(File, int) line: 147
	JarFile.<init>(File, boolean, int, JarFile$Release) line: 344
	URLClassPath$JarLoader.getJarFile(URL) line: 697
	URLClassPath$JarLoader.access$600(URLClassPath$JarLoader, URL) line:
586
	URLClassPath$JarLoader$1.run() line: 642
	URLClassPath$JarLoader$1.run() line: 635
	AccessController.doPrivileged(PrivilegedExceptionAction<T>) line: not
available [native method]
	URLClassPath$JarLoader.ensureOpen() line: 634
	URLClassPath$JarLoader.<init>(URL, URLStreamHandler,
HashMap<String,Loader>) line: 609
	URLClassPath$3.run() line: 389
	URLClassPath$3.run() line: 373
	AccessController.doPrivileged(PrivilegedExceptionAction<T>) line: not
available [native method]
	URLClassPath.getLoader(URL) line: 372
	URLClassPath.getLoader(int) line: 349
	URLClassPath.access$000(URLClassPath, int) line: 81
	URLClassPath$1.next() line: 242
	URLClassPath$1.hasMoreElements() line: 253
	URLClassLoader$3$1.run() line: 595
	URLClassLoader$3$1.run() line: 593
	AccessController.doPrivileged(PrivilegedAction<T>,
AccessControlContext) line: not available [native method]
	URLClassLoader$3.next() line: 592
	URLClassLoader$3.hasMoreElements() line: 617 [local variables
unavailable]
	CompoundEnumeration<E>.next() line: 2683
	CompoundEnumeration<E>.hasMoreElements() line: 2692
	ServiceLoader$LazyClassPathIterator.hasNextService() line: 786
	ServiceLoader$LazyClassPathIterator(ServiceLoader
$RestrictedIterator<S>).hasNext() line: 527 [local variables unavailable]
	ServiceLoader$2.hasNext() line: 907 [local variables unavailable]
	BatchAnnotationProcessorManager.discoverNextProcessor() line: 155



More information about the jigsaw-dev mailing list