Skip to content

Conversation

@Rajin9601
Copy link
Contributor

While debugging deadlock in our application, I found that spring-boot's LaunchedClassLoader is not registered as parallel capable class loader.

Even though LaunchedClassLoader register itself as parallel capable, ClassLoader only accepts registerAsParallelCapable if the super class is also parallel capable.

https://github.com/openjdk/jdk/blob/f174bbd3baf351ae9248b70454b3bc5a89acd7c6/src/java.base/share/classes/java/lang/ClassLoader.java#L270-L284

 static boolean register(Class<? extends ClassLoader> c) { synchronized (loaderTypes) { if (loaderTypes.contains(c.getSuperclass())) { // register the class loader as parallel capable // if and only if all of its super classes are. // Note: given current classloading sequence, if // the immediate super class is parallel capable, // all the super classes higher up must be too. loaderTypes.add(c); return true; } else { return false; } } 

Looking at this issue (#7333), it seems LaunchedClassLoader is parallel capable. So this PR registers LaunchedClassLoader's parent class, JarUrlClassLoader as parallel capable.

@pivotal-cla
Copy link

@Rajin9601 Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@pivotal-cla
Copy link

@Rajin9601 Thank you for signing the Contributor License Agreement!

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 1, 2024
@wilkinsona
Copy link
Member

Thanks very much, @Rajin9601.

This looks like a regression in 3.2 to me where JarUrlClassLoader was introduced as the super-class of LaunchedURLClassLoader. In 3.2 with the classic loader or in 3.1, LaunchedURLClasssLoader extends URLClassLoader and will be parallel capable.

@wilkinsona wilkinsona changed the title register JarUrlClassLoader as parallel capable LaunchedURLClassLoader is no longer parallel capable Aug 13, 2024
@wilkinsona wilkinsona added this to the 3.2.x milestone Aug 13, 2024
@wilkinsona wilkinsona added type: regression A regression from a previous release and removed status: waiting-for-triage An issue we've not yet triaged labels Aug 13, 2024
@wilkinsona wilkinsona changed the title LaunchedURLClassLoader is no longer parallel capable Launcher's ClassLoader is no longer parallel capable Aug 15, 2024
@wilkinsona wilkinsona modified the milestones: 3.2.x, 3.2.9 Aug 15, 2024
wilkinsona pushed a commit that referenced this pull request Aug 15, 2024
@wilkinsona
Copy link
Member

Thanks very much, @Rajin9601 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: regression A regression from a previous release

4 participants