geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevan Miller (JIRA)" <j...@apache.org>
Subject [jira] Commented: (GERONIMO-4458) Another ClassLoader deadlock during server startup
Date Fri, 12 Dec 2008 17:26:44 GMT

    [ https://issues.apache.org/jira/browse/GERONIMO-4458?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12656075#action_12656075
] 

Kevan Miller commented on GERONIMO-4458:
----------------------------------------

I understand the basic issue:

At present, ClassFileTransformer's can introduce cycles in our ClassLoader structure.

Imagine a ClassLoader A whose parents are ClassLoaders B and C. B's parent is C.

{noformat}

           C
         /    \
        B    |
           \  |
             A          
{noformat}

On Thread 1 (whose ContextClassLoader is A), we're trying to load a class Z1 and hold monitors
on A and C.
On Thread 2 (whose ContextClassLoader is B), we're trying to load a class Z2 and hold a monitor
on B and are waiting for a monitor on C.

On Thread1, we are loading class Z1 from ClassLoader C. This will trigger ClassFileTransformer
processing for Z1. If this processing requires any Classes to be loaded, we're going to start
loading classes using the Thread ContextClassLoader (i.e. A). Since B is a parent of A, we
may search ClassLoader B (making B a logical parent of C). So, we have an indirect cycle in
our ClassLoader hierarchy.

I think we need to:

1. Set the Thread ContextClassLoader from oag.transform.TransformerCollection.transform()
before invoking registered ClassFileTransformers.
2. Move all ClassFileTransformer jars into the primordial ClassLoader. 

I've hacked together a server that does the above (hacks were to the server.jar manifest --
i.e. not integrated into a build, yet).

I'm running tests with the above (repeated server starts/stops) and have yet to encounter
a problem. Assuming tests continue to run well, I'll intend on making the above changes.

Comments welcome...

> Another ClassLoader deadlock during server startup
> --------------------------------------------------
>
>                 Key: GERONIMO-4458
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-4458
>             Project: Geronimo
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>    Affects Versions: 2.2
>            Reporter: Kevan Miller
>            Priority: Critical
>             Fix For: 2.2
>
>
> G 2.2 TCK testing is running into a ClassLoader deadlock. Here are the stacktraces:
> {noformat}
> Found one Java-level deadlock:
> =============================
> "RMI TCP Connection(4)-9.42.75.229":
>  waiting to lock monitor 0x0849be70 (object 0xd57192c8, a org.apache.geronimo.kernel.config.MultiParentClassLoader),
>  which is held by "main"
> "main":
>  waiting to lock monitor 0x0849bed4 (object 0xd50ca400, a org.apache.geronimo.kernel.config.ChildrenConfigurationClassLoader),
>  which is held by "RMI TCP Connection(4)-9.42.75.229"
> Java stack information for the threads listed above:
> ===================================================
> "RMI TCP Connection(4)-9.42.75.229":
>        at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHolder.<init>(WeavingAdaptor.java:498)
>        at org.aspectj.weaver.tools.WeavingAdaptor.createMessageHandler(WeavingAdaptor.java:179)
>        at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.initialize(ClassLoaderWeavingAdaptor.java:111)
>        at org.aspectj.weaver.loadtime.Aj$ExplicitlyInitializedClassLoaderWeavingAdaptor.initialize(Aj.java:151)
>        at org.aspectj.weaver.loadtime.Aj$ExplicitlyInitializedClassLoaderWeavingAdaptor.getWeavingAdaptor(Aj.java:156)
>        at org.aspectj.weaver.loadtime.Aj$WeaverContainer.getWeaver(Aj.java:122)
>        at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:73)
>        - locked <0xd4f23b40> (a org.apache.geronimo.kernel.config.MultiParentClassLoader)
>        at org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:52)
>        at org.apache.geronimo.transformer.TransformerCollection.transform(TransformerCollection.java:43)
>        at sun.instrument.TransformerManager.transform(TransformerManager.java:169)
>        at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:365)
>        at java.lang.ClassLoader.defineClass1(Native Method)
>        at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
>        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
>        at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
>        at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
>        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>        at org.apache.geronimo.kernel.config.MultiParentClassLoader.loadClassInternal(MultiParentClassLoader.java:455)
>        - locked <0xd4f23b40> (a org.apache.geronimo.kernel.config.MultiParentClassLoader)
>        at org.apache.geronimo.kernel.config.ChildrenConfigurationClassLoader.loadClass(ChildrenConfigurationClassLoader.java:69)
>        - locked <0xd4ea35c8> (a org.apache.geronimo.kernel.config.ChildrenConfigurationClassLoader)
>        at org.apache.geronimo.kernel.config.ChildrenConfigurationClassLoader.loadClass(ChildrenConfigurationClassLoader.java:52)
>        at org.apache.geronimo.kernel.config.MultiParentClassLoader.checkParents(MultiParentClassLoader.java:483)
>        - locked <0xd50ca440> (a org.apache.geronimo.kernel.config.MultiParentClassLoader)
>        at org.apache.geronimo.kernel.config.MultiParentClassLoader.loadClassInternal(MultiParentClassLoader.java:441)
>        - locked <0xd50ca440> (a org.apache.geronimo.kernel.config.MultiParentClassLoader)
>        at org.apache.geronimo.kernel.config.ChildrenConfigurationClassLoader.loadClass(ChildrenConfigurationClassLoader.java:69)
>        - locked <0xd50ca400> (a org.apache.geronimo.kernel.config.ChildrenConfigurationClassLoader)
>        at org.apache.geronimo.kernel.config.ChildrenConfigurationClassLoader.loadClass(ChildrenConfigurationClassLoader.java:52)
>        at org.apache.geronimo.kernel.config.MultiParentClassLoader.checkParents(MultiParentClassLoader.java:483)
>        - locked <0xd51f63e8> (a org.apache.geronimo.kernel.config.MultiParentClassLoader)
>        at org.apache.geronimo.kernel.config.MultiParentClassLoader.loadOptimizedClass(MultiParentClassLoader.java:392)
>        - locked <0xd51f63e8> (a org.apache.geronimo.kernel.config.MultiParentClassLoader)
>        at org.apache.geronimo.kernel.config.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:255)
>        - locked <0xd51f63e8> (a org.apache.geronimo.kernel.config.MultiParentClassLoader)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
>        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
>        - locked <0xd51f63e8> (a org.apache.geronimo.kernel.config.MultiParentClassLoader)
>        at java.lang.Class.getDeclaredConstructors0(Native Method)
>        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
>        at java.lang.Class.getConstructor0(Class.java:2699)
>        at java.lang.Class.newInstance0(Class.java:326)
>        at java.lang.Class.newInstance(Class.java:308)
>        at org.apache.geronimo.security.jaas.ClassOptionLoginModule.initialize(ClassOptionLoginModule.java:50)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:756)
>        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
>        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
>        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)
>        at org.apache.geronimo.jmxremoting.Authenticator.authenticate(Authenticator.java:68)
>        at javax.management.remote.rmi.RMIServerImpl.doNewClient(RMIServerImpl.java:213)
>        at javax.management.remote.rmi.RMIServerImpl.newClient(RMIServerImpl.java:180)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
>        at sun.rmi.transport.Transport$1.run(Transport.java:159)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
>        at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
>        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
>        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
>        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>        at java.lang.Thread.run(Thread.java:619)
> "main":
>        at org.apache.geronimo.kernel.config.ChildrenConfigurationClassLoader.loadClass(ChildrenConfigurationClassLoader.java:61)
>        - waiting to lock <0xd50ca400> (a
> org.apache.geronimo.kernel.config.ChildrenConfigurationClassLoader)
>        at org.apache.geronimo.kernel.config.ChildrenConfigurationClassLoader.loadClass(ChildrenConfigurationClassLoader.java:52)
>        at org.apache.geronimo.kernel.config.MultiParentClassLoader.checkParents(MultiParentClassLoader.java:483)
>        - locked <0xd51edbf8> (a org.apache.geronimo.kernel.config.MultiParentClassLoader)
>        at org.apache.geronimo.kernel.config.MultiParentClassLoader.loadClassInternal(MultiParentClassLoader.java:441)
>        - locked <0xd51edbf8> (a org.apache.geronimo.kernel.config.MultiParentClassLoader)
>        at org.apache.geronimo.kernel.config.ChildrenConfigurationClassLoader.loadClass(ChildrenConfigurationClassLoader.java:69)
>        - locked <0xd51eec50> (a org.apache.geronimo.kernel.config.ChildrenConfigurationClassLoader)
>        at org.apache.geronimo.kernel.config.ChildrenConfigurationClassLoader.loadClass(ChildrenConfigurationClassLoader.java:52)
>        at org.apache.geronimo.kernel.config.MultiParentClassLoader.checkParents(MultiParentClassLoader.java:483)
>        - locked <0xd57192c8> (a org.apache.geronimo.kernel.config.MultiParentClassLoader)
>        at org.apache.geronimo.kernel.config.MultiParentClassLoader.loadOptimizedClass(MultiParentClassLoader.java:392)
>        - locked <0xd57192c8> (a org.apache.geronimo.kernel.config.MultiParentClassLoader)
>        at org.apache.geronimo.kernel.config.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:255)
>        - locked <0xd57192c8> (a org.apache.geronimo.kernel.config.MultiParentClassLoader)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
>        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
>        - locked <0xd57192c8> (a org.apache.geronimo.kernel.config.MultiParentClassLoader)
>        at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHolder.<init>(WeavingAdaptor.java:498)
>        at org.aspectj.weaver.tools.WeavingAdaptor.createMessageHandler(WeavingAdaptor.java:179)
>        at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.initialize(ClassLoaderWeavingAdaptor.java:111)
>        at org.aspectj.weaver.loadtime.Aj$ExplicitlyInitializedClassLoaderWeavingAdaptor.initialize(Aj.java:151)
>        at org.aspectj.weaver.loadtime.Aj$ExplicitlyInitializedClassLoaderWeavingAdaptor.getWeavingAdaptor(Aj.java:156)
>        at org.aspectj.weaver.loadtime.Aj$WeaverContainer.getWeaver(Aj.java:122)
>        at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:73)
>        - locked <0xd5712f78> (a org.apache.geronimo.kernel.config.MultiParentClassLoader)
>        at org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:52)
>        at org.apache.geronimo.transformer.TransformerCollection.transform(TransformerCollection.java:43)
>        at sun.instrument.TransformerManager.transform(TransformerManager.java:169)
>        at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:365)
>        at java.lang.ClassLoader.defineClass1(Native Method)
>        at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
>        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
>        at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
>        at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
>        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>        at org.apache.geronimo.kernel.config.MultiParentClassLoader.loadOptimizedClass(MultiParentClassLoader.java:407)
>        - locked <0xd5712f78> (a org.apache.geronimo.kernel.config.MultiParentClassLoader)
>        at org.apache.geronimo.kernel.config.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:255)
>        - locked <0xd5712f78> (a org.apache.geronimo.kernel.config.MultiParentClassLoader)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
>        at org.apache.geronimo.gbean.runtime.GBeanInstance.<init>(GBeanInstance.java:228)
>        at org.apache.geronimo.kernel.basic.BasicKernel.loadGBean(BasicKernel.java:352)
>        at org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:441)
>        at org.apache.geronimo.kernel.config.KernelConfigurationManager.start(KernelConfigurationManager.java:190)
>        at org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:562)
>        - locked <0xd500a750> (a org.apache.geronimo.kernel.config.EditableKernelConfigurationManager)
>        at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34)
>        at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:130)
>        at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:815)
>        at org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:57)
>        at org.apache.geronimo.kernel.basic.RawOperationInvoker.invoke(RawOperationInvoker.java:35)
>        at org.apache.geronimo.kernel.basic.ProxyMethodInterceptor.intercept(ProxyMethodInterceptor.java:96)
>        at org.apache.geronimo.gbean.GBeanLifecycle$$EnhancerByCGLIB$$752a2ecb.startConfiguration(<generated>)
>        at org.apache.geronimo.system.main.EmbeddedDaemon.doStartup(EmbeddedDaemon.java:161)
>        at org.apache.geronimo.system.main.EmbeddedDaemon.execute(EmbeddedDaemon.java:78)
>        at org.apache.geronimo.kernel.util.MainConfigurationBootstrapper.main(MainConfigurationBootstrapper.java:45)
>        at org.apache.geronimo.cli.AbstractCLI.executeMain(AbstractCLI.java:65)
>        at org.apache.geronimo.cli.daemon.DaemonCLI.main(DaemonCLI.java:30)
> {noformat}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message