Is there any chance of fixing this by making the LoaderRepository into a classloader, and the only one accessible externally? Maybe it could check the cache unsynchronized, and then, synchronized on itself, try to load the class from its UnifiedClassLoaders, so only one call at a time could get to the native code and the evil method. Would this require that we be able to set the classloader on the classes ?
david jencks On 2002.04.24 20:44:05 -0400 Alarik Myrin wrote: > Never mind the suggestion of synchronizing on (this.getClass()), you just > run into the same problem. I'll try and given the matter some thought, > although I don't know how much hope I'd hold out for a brilliant idea > from > me... > > Alarik > > > -----Original Message----- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED]]On Behalf Of > > Alarik Myrin > > Sent: Wednesday, April 24, 2002 8:22 PM > > To: [EMAIL PROTECTED] > > Subject: RE: [JBoss-dev] Workaround for JUNG's RFE and load deadlock > > > > > > Alas, I am getting a little further, but still getting a deadlock. > Below > > please find the relavent stack traces. Here is my take on what they > might > > mean, in case it is interesting to you: > > > > There are two relavent threads. One (the first stack trace) is trying > to > > load a class needed by a stateless session bean in an effor to deploy > the > > bean. The class does not exist in the bean's jar file, instead > > it exists in > > a another archive called picasso.zip. The other (the second stack > trace), > > was spawned by a class found in picasso.zip. It is trying to load a > class > > from (I suspect) a third party jar file called osji.jar. Because > > there is a > > seperate class loader for each archive, the deadlock becomes > > possible. Does > > this sound right? (I am not really an expert at class loading, > > but learning > > as I go :). > > > > What makes this problem quite tricky (it seems to me) is that in both > > threads the UnifiedClassLoader instance is _already locked_ by the time > > _any_ of its methods are even executed. > > > > What about this: instead of > > > > /** > > * We intercept the load class to know exactly the dependencies > > * of the underlying jar. > > * > > * <p>Forwards request to {@link UnifiedLoaderRepository}. > > */ > > public Class loadClass(String name, boolean resolve) > > throws ClassNotFoundException > > { > > synchronized(this) > > { > > return repository.loadClass(name, resolve, this); > > } > > } > > > > What if we did this: > > > > /** > > * We intercept the load class to know exactly the dependencies > > * of the underlying jar. > > * > > * <p>Forwards request to {@link UnifiedLoaderRepository}. > > */ > > public Class loadClass(String name, boolean resolve) > > throws ClassNotFoundException > > { > > synchronized(this.getClass()) > > { > > return repository.loadClass(name, resolve, this); > > } > > } > > > > Another observation: startup appears to be taking noticably > > longer than it > > did with JBoss 2.4.x, even in parts of the startup process where I > suspect > > it is mostly just executing my code. The CPU just spikes like crazy. > > Whenever I do a thread dump to check what it is up to, it always > > appears to > > be trying to load a class. Startup time isn't the most important thing > in > > the world, but it does impact the speed of development (although I > suspect > > that if I really understood the power of the deploy/undeploy > functionality > > of JBoss 3, I wouldn't need to restart the server nearly so often...). > > > > Anyway, I hope all of this helps. I'll be available all week to run > any > > tests you'd like, but then I start traveling for almost a month... > > > > Alarik > > > > "main" prio=5 tid=0xc7d640 nid=0x157 waiting for monitor entry > > [0x93fd000..0x93ffdc0] > > at java.lang.ClassLoader.loadClass(ClassLoader.java:286) > > - waiting to lock <3329c48> (a > > org.jboss.mx.loading.UnifiedClassLoader) > > at > > org.jboss.mx.loading.UnifiedClassLoader.loadClassLocally(UnifiedCl > > assLoader. > > java:180) > > at > > org.jboss.mx.loading.UnifiedLoaderRepository.loadClass(UnifiedLoad > > erReposito > > ry.java:178) > > at > > org.jboss.mx.loading.UnifiedClassLoader.loadClass(UnifiedClassLoad > > er.java:21 > > 7) > > at java.lang.ClassLoader.loadClass(ClassLoader.java:253) > > at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313) > > - locked <330edc0> (a org.jboss.mx.loading.UnifiedClassLoader) > > at java.lang.Class.forName0(Native Method) > > at java.lang.Class.forName(Class.java:195) > > at com.odi.ClassInfo.lookupClassInfoByName(ClassInfo.java:608) > > at com.odi.ClassInfo.lookupClassInfoByName(ClassInfo.java:589) > > at com.odi.ClassInfo.findAndRegister(ClassInfo.java:502) > > at com.odi.ClassInfo.get(ClassInfo.java:483) > > at > > com.sknt.picasso.lib.gui.TableConfiguration.getClassInfoInstance(T > > ableConfig > > uration.java) > > at > > com.sknt.picasso.lib.gui.TableConfiguration.<clinit>(TableConfigur > > ation.java > > ) > > at java.lang.Class.forName0(Native Method) > > at java.lang.Class.forName(Class.java:120) > > at $Proxy99.<clinit>(Unknown Source) > > at java.lang.reflect.Constructor.newInstance(Native Method) > > at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:562) > > at > > org.jboss.proxy.ejb.ProxyFactory.bindProxy(ProxyFactory.java:323) > > at org.jboss.proxy.ejb.ProxyFactory.start(ProxyFactory.java:185) > > at > > org.jboss.ejb.StatelessSessionContainer.start(StatelessSessionCont > > ainer.java > > :206) > > at org.jboss.ejb.Container.invoke(Container.java:794) > > at > > org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:492) > > at > > org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceCont > > roller.jav > > a:867) > > at $Proxy0.start(Unknown Source) > > at > > org.jboss.system.ServiceController.start(ServiceController.java:341) > > - locked <327ce58> (a org.jboss.system.ServiceController) > > at java.lang.reflect.Method.invoke(Native Method) > > at > > org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedM > > BeanDispat > > cher.java:284) > > at > > org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:492) > > at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174) > > at $Proxy96.start(Unknown Source) > > at org.jboss.ejb.EjbModule.startService(EjbModule.java:440) > > at > > org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:162) > > at java.lang.reflect.Method.invoke(Native Method) > > at > > org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedM > > BeanDispat > > cher.java:284) > > at > > org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:492) > > at > > org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceCont > > roller.jav > > a:867) > > at $Proxy0.start(Unknown Source) > > at > > org.jboss.system.ServiceController.start(ServiceController.java:341) > > - locked <327ce58> (a org.jboss.system.ServiceController) > > at java.lang.reflect.Method.invoke(Native Method) > > at > > org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedM > > BeanDispat > > cher.java:284) > > at > > org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:492) > > at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174) > > at $Proxy5.start(Unknown Source) > > at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:394) > > - locked <36b3ef8> (a org.jboss.ejb.EJBDeployer) > > at org.jboss.deployment.MainDeployer.start(MainDeployer.java:690) > > at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:525) > > at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:488) > > at java.lang.reflect.Method.invoke(Native Method) > > at > > org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedM > > BeanDispat > > cher.java:284) > > at > > org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:492) > > at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174) > > at $Proxy4.deploy(Unknown Source) > > at > > org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploy > > mentScanne > > r.java:405) > > at > > org.jboss.deployment.scanner.URLDeploymentScanner.scanDirectory(UR > > LDeploymen > > tScanner.java:586) > > at > > org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeployme > > ntScanner. > > java:465) > > - locked <36b9090> (a java.util.Collections$SynchronizedList) > > - locked <36b8aa8> (a > > org.jboss.deployment.scanner.URLDeploymentScanner) > > at > > org.jboss.deployment.scanner.AbstractDeploymentScanner.startServic > > e(Abstract > > DeploymentScanner.java:237) > > at > > org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:162) > > at java.lang.reflect.Method.invoke(Native Method) > > at > > org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedM > > BeanDispat > > cher.java:284) > > at > > org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:492) > > at > > org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceCont > > roller.jav > > a:867) > > at $Proxy0.start(Unknown Source) > > at > > org.jboss.system.ServiceController.start(ServiceController.java:341) > > - locked <327ce58> (a org.jboss.system.ServiceController) > > at java.lang.reflect.Method.invoke(Native Method) > > at > > org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedM > > BeanDispat > > cher.java:284) > > at > > org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:492) > > at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174) > > at $Proxy3.start(Unknown Source) > > at org.jboss.deployment.SARDeployer.start(SARDeployer.java:281) > > at org.jboss.deployment.MainDeployer.start(MainDeployer.java:690) > > at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:525) > > at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:488) > > at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:470) > > at java.lang.reflect.Method.invoke(Native Method) > > at > > org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedM > > BeanDispat > > cher.java:284) > > at > > org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:492) > > at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:320) > > at org.jboss.system.server.ServerImpl.start(ServerImpl.java:218) > > at org.jboss.Main.boot(Main.java:142) > > at org.jboss.Main$1.run(Main.java:375) > > at java.lang.Thread.run(Thread.java:484) > > > > "Thread-29" prio=5 tid=0xb59a6b0 nid=0xe6 waiting for monitor entry > > [0xc6af000..0xc6afdc0] > > at java.lang.ClassLoader.loadClass(ClassLoader.java:286) > > - waiting to lock <330edc0> (a > > org.jboss.mx.loading.UnifiedClassLoader) > > at > > org.jboss.mx.loading.UnifiedClassLoader.loadClassLocally(UnifiedCl > > assLoader. > > java:180) > > at > > org.jboss.mx.loading.UnifiedLoaderRepository.loadClass(UnifiedLoad > > erReposito > > ry.java:178) > > at > > org.jboss.mx.loading.UnifiedClassLoader.loadClass(UnifiedClassLoad > > er.java:21 > > 7) > > at java.lang.ClassLoader.loadClass(ClassLoader.java:253) > > at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313) > > - locked <3329c48> (a org.jboss.mx.loading.UnifiedClassLoader) > > at java.lang.Class.forName0(Native Method) > > at java.lang.Class.forName(Class.java:120) > > at com.odi.imp.Server.create(Server.java:106) > > at com.odi.imp.ObjectManager.<init>(ObjectManager.java:4093) > > at com.odi.Session.create(Session.java:502) > > - locked <3887ac0> (a java.util.Hashtable) > > at > > com.sknt.picasso.lib.PicassoServerEnv.startJMS(PicassoServerEnv.java:393) > > at > > com.sknt.picasso.lib.PicassoServerEnv$TestJMS.run(PicassoServerEnv > > .java:771) > > - locked <44893c8> (a > > com.sknt.picasso.lib.PicassoServerEnv$TestJMS) > > at java.lang.Thread.run(Thread.java:484) > > > > > -----Original Message----- > > > From: [EMAIL PROTECTED] > > > [mailto:[EMAIL PROTECTED]]On Behalf Of > marc > > > fleury > > > Sent: Wednesday, April 24, 2002 10:36 AM > > > To: [EMAIL PROTECTED] > > > Subject: Re: [JBoss-dev] Workaround for JUNG's RFE and load deadlock > > > > > > > > > Done, > > > > > > Dave please test > > > > > > Jung, thanks man > > > > > > marcf > > > > > > > > > * * * > > > > > > View thread online: > > > http://jboss.org/forums/thread.jsp?forum=66&thread=13851 > > > > > > _______________________________________________ > > > Jboss-development mailing list > > > [EMAIL PROTECTED] > > > https://lists.sourceforge.net/lists/listinfo/jboss-development > > > > > > > > > _______________________________________________ > > Jboss-development mailing list > > [EMAIL PROTECTED] > > https://lists.sourceforge.net/lists/listinfo/jboss-development > > > > > _______________________________________________ > Jboss-development mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-development > > _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
