Thanks Florent. Now visible at
https://bugs.openjdk.java.net/browse/JDK-8230297
regards,
Sean.
On 27/08/2019 20:04, Florent Guillaume wrote:
I'm not an Author so I created the ticket on bugreport.java.com
<http://bugreport.java.com>, it has the internal review ID 9062061
Thanks,
Florent
On Tue, Aug 27, 2019 at 6:04 PM Seán Coffey <[email protected]
<mailto:[email protected]>> wrote:
Probably best to log a bug to capture this issue.
It reminds me of another issue I've been meaning to wrap up:
https://bugs.openjdk.java.net/browse/JDK-8223260
Similar scenario in how the ContextFactory is searched for. My
proposed
patch is to cache a factory per classloader (for the NamingManager
issue at least)
regards,
Sean.
On 27/08/2019 16:16, Florent Guillaume wrote:
Hi,
When switching from Java 8 to Java 11, we're experiencing an
important slowdown when executing LoginContext.login(),
especially under concurrency.
We tracked this down to JDK-8047789 which changed the way the
lookup of LoginModules is done in LoginContext.invoke.
Previously, it was a simple Class.forName that is of course
extremely optimized. After JDK-8047789, there is first a
ServiceLoader-based lookup for the class. This lookup doesn't
seem to be cached. In our case, it has to open the 400+ JARs in
our classpath (we're not using modules yet) to check the content
of META-INF/services/javax.security.auth.spi.LoginModule, and in
addition this hits a synchronized block in ZipFile.getEntry which
prevents any performance under concurrency.
Is there anything we can do to improve LoginContext.login() in
this context?
For reference, the code path to the synchronized block:
at
java.util.zip.ZipFile.getEntry([email protected]/ZipFile.java:346
<mailto:[email protected]/ZipFile.java:346>)
- locked <0x000000068b18bdd0> (a java.util.jar.JarFile)
at
java.util.zip.ZipFile$1.getEntry([email protected]/ZipFile.java:1121
<mailto:[email protected]/ZipFile.java:1121>)
at
java.util.jar.JarFile.getEntry0([email protected]/JarFile.java:576
<mailto:[email protected]/JarFile.java:576>)
at
java.util.jar.JarFile.getEntry([email protected]/JarFile.java:506
<mailto:[email protected]/JarFile.java:506>)
at
java.util.jar.JarFile.getJarEntry([email protected]/JarFile.java:468
<mailto:[email protected]/JarFile.java:468>)
at
jdk.internal.loader.URLClassPath$JarLoader.getResource([email protected]/URLClassPath.java:929
<mailto:[email protected]/URLClassPath.java:929>)
at
jdk.internal.loader.URLClassPath$JarLoader.findResource([email protected]/URLClassPath.java:912
<mailto:[email protected]/URLClassPath.java:912>)
at
jdk.internal.loader.URLClassPath$1.next([email protected]/URLClassPath.java:341
<mailto:[email protected]/URLClassPath.java:341>)
at
jdk.internal.loader.URLClassPath$1.hasMoreElements([email protected]/URLClassPath.java:351
<mailto:[email protected]/URLClassPath.java:351>)
at
java.net.URLClassLoader$3$1.run([email protected]/URLClassLoader.java:687
<mailto:[email protected]/URLClassLoader.java:687>)
at
java.net.URLClassLoader$3$1.run([email protected]/URLClassLoader.java:685
<mailto:[email protected]/URLClassLoader.java:685>)
at
java.security.AccessController.doPrivileged([email protected]/Native
<mailto:[email protected]/Native> Method)
at
java.net.URLClassLoader$3.next([email protected]/URLClassLoader.java:684
<mailto:[email protected]/URLClassLoader.java:684>)
at
java.net.URLClassLoader$3.hasMoreElements([email protected]/URLClassLoader.java:709
<mailto:[email protected]/URLClassLoader.java:709>)
at
java.lang.CompoundEnumeration.next([email protected]/ClassLoader.java:3022
<mailto:[email protected]/ClassLoader.java:3022>)
at
java.lang.CompoundEnumeration.hasMoreElements([email protected]/ClassLoader.java:3031
<mailto:[email protected]/ClassLoader.java:3031>)
at
org.apache.catalina.loader.WebappClassLoaderBase$CombinedEnumeration.inc(WebappClassLoaderBase.java:2670)
at
org.apache.catalina.loader.WebappClassLoaderBase$CombinedEnumeration.hasMoreElements(WebappClassLoaderBase.java:2655)
at
java.util.ServiceLoader$LazyClassPathLookupIterator.nextProviderClass([email protected]/ServiceLoader.java:1202
<mailto:[email protected]/ServiceLoader.java:1202>)
at
java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService([email protected]/ServiceLoader.java:1220
<mailto:[email protected]/ServiceLoader.java:1220>)
at
java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext([email protected]/ServiceLoader.java:1264
<mailto:[email protected]/ServiceLoader.java:1264>)
at
java.util.ServiceLoader$2.hasNext([email protected]/ServiceLoader.java:1299
<mailto:[email protected]/ServiceLoader.java:1299>)
at
java.util.ServiceLoader$3.hasNext([email protected]/ServiceLoader.java:1384
<mailto:[email protected]/ServiceLoader.java:1384>)
at
javax.security.auth.login.LoginContext.invoke([email protected]/LoginContext.java:691
<mailto:[email protected]/LoginContext.java:691>)
at
javax.security.auth.login.LoginContext$4.run([email protected]/LoginContext.java:665
<mailto:[email protected]/LoginContext.java:665>)
at
javax.security.auth.login.LoginContext$4.run([email protected]/LoginContext.java:663
<mailto:[email protected]/LoginContext.java:663>)
at
java.security.AccessController.doPrivileged([email protected]/Native
<mailto:[email protected]/Native> Method)
at
javax.security.auth.login.LoginContext.invokePriv([email protected]/LoginContext.java:663
<mailto:[email protected]/LoginContext.java:663>)
at
javax.security.auth.login.LoginContext.login([email protected]/LoginContext.java:574
<mailto:[email protected]/LoginContext.java:574>)
Thanks,
Florent
--
Nuxeo Logo <https://www.nuxeo.com/>
Florent Guillaume Head of R&D LinkedIn
<https://www.linkedin.com/in/fguillaume/> Twitter
<https://twitter.com/efge> Github <https://github.com/efge>
Nuxeo Content Services Platform. Stay ahead.
--
Nuxeo Logo <https://www.nuxeo.com/>
Florent Guillaume Head of R&D LinkedIn
<https://www.linkedin.com/in/fguillaume/> Twitter
<https://twitter.com/efge> Github <https://github.com/efge>
Nuxeo Content Services Platform. Stay ahead.