This is a corresponding Sun bug ID for oracle bug: 10313631
https://bug.oraclecorp.com/pls/bug/webbug_print.show?c_rptno=10313631
WLS team have reported a deadlock situation with our classloader. Analysis of issue reported in bug.oraclecorp. Copy/paste of issue is :
*** KRCHAKR 11/18/10 10:08 am ***
A remote call (RMI) from Weblogic client resulted in the following deadlock
in VM as shown in bugs -
1. 10274213
2. 9381468
Here the code (java.lang.ClassLoader) that causes the issue -
protected Package getPackage(String name) {
synchronized (packages) {
Package pkg = (Package)packages.get(name);
if (pkg == null) {
if (parent != null) {
pkg = parent.getPackage(name);
} else {
pkg = Package.getSystemPackage(name); - This Static call goes to
create a new URL for a system code source that in turn loads a protocol
handler class for "file" through ClassLoader.loadClass() thus resulting in
the deadlock.
}
if (pkg != null) {
packages.put(name, pkg);
}
}
return pkg;
}
}
The call finally goes into Package.defineSystemPackage(). The call then
steps in ParseUtil.fileToEncodedURL(). In this method, the VM has to create a
new URL(). In the URL() constructor, if the handler for "file" protocol is
null(), there is a call to getURLStreamHandler(). This method looks at the
factory and if it does not find the handler does the following -
try {
cls = Class.forName(clsName);
} catch (ClassNotFoundException e) {
ClassLoader cl = ClassLoader.getSystemClassLoader();
if (cl != null) {
cls = cl.loadClass(clsName);
}
}
If the context classloader is not the system classloader (which it is not),
it will fall back in <systemclassloader>.loadClass() to load the protocol
handler for the "file" protocol. loadClass() will go back into the
ClassLoader.getPackage() causing the deadlock.
*** KRCHAKR 11/18/10 10:10 am ***
This is a HOTSPOT bug. Please re-assign to HOTSpot team.
*** KRCHAKR 11/18/10 10:15 am ***
One early thought is to force the loading of the file URLStreamHandler early in load process before another calling thread places a lock on the getPackage call. Comments from classloader experts are welcome here.
|