[Resin-interest] Follow-up on my classloader recycle issue
Thanks for replies, Scott and Daniel! Today I went the 'find references and eliminate them' way. I looked into heap dump, found reference that could possibly screw things, and eliminated it. After each of them I started resin, touched web.xml for a few times and dumped heap. I've found this OQL query to be helpful, maybe someone else will need it someday: select map(filter(referrers(heap.findObject(0xsome ClassLoader ref)), it.name != null), heap.objects(it)) It lists all still-living class instances to classes loaded inside that classloader. More specifically, I've cleaned: - The only ThreadLocal we've got. - Properly closed Hibernate session - weird thing is that it did not led to dereferencing of that LanguageType objects. - Made two @attributes source-only - I'll have to revert that, but they were causing to those $ProxyXX instances floating around in soft references. - resin's SessionManager.close(): added _webApp = null; since I saw in dump SessionManagerAdmin was referencing SessionManager that referenced Application which was unable to garbage-collect and thus was holding classloader. Maybe I'm wrong here, but SessionManagerAdmin was referenced by those bean management services, and Application in question had a _sessionManager = null and still was referenced over that chain. - finally I've got rid of static ServletContext context; in one of classes. Theoretically, i think, it should be recycled because this dependency is circular: that class depends on ClassLoader, ClassLoader on Application, Application on that class. But practically, as I've found, I shouldn't do that :) After this, EnvironmentClassLoaders stopped spawning like crazy: if I run resin and touch web.xml for 10 times, I end up with four EnvorinmentClassLoader's for that web-app. That's still more than one, but here I think maybe JVM is just cleaning its garbage lazily: I've observed ClassLoader without Application in it, obviously it should be collected on the next run. - after that I've dropped two Application references in instance variables, with no noticeable difference. That list might seem lame in a sence 'he should have done all that long ago', but a few days ago I was all like 'a classloader? what's that?' - I knew theoretically that Classloaders exist and that garbage collector doesn't claim referenced objects, but I didn't think much about that, I didn't know that can cause problems. I'll now try to carefully revert some of those changes, and in future I'll care more about reference sanity. P.S. to Scott: I've looked at _scanListeners, but they're like 0 : [EMAIL PROTECTED] (64 bytes) 1 : [EMAIL PROTECTED] (113 bytes) 2 : null so I don't think they caused that problems. I think it was just my ignorance about static references being not necessarily good for one's health. ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
Re: [Resin-interest] Webbeans interceptor exceptions
On Jan 16, 2008, at 11:38 AM, wesley wrote: I wrote an interceptor for some webbeans component. Thanks. That's some extra debugging code. I've filed a bug at http://bugs.caucho.com/view.php?id=2344 The webbeans interceptor implementation is going to change this week, since we're going to integrate the webbeans interception with the ejb interception. So webbeans will be able to use ejb interceptors and ejb interceptors can use webbeans annotations, and all our tests will cover the same code. It's going to be very cool. -- Scott code: ==The InterceptorBindingType @InterceptorBindingType @Target({ElementType.METHOD, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface BlockCachable { } The Interceptor= @BlockCachable @Interceptor public class BlockModelCacheInterceptor { private static final Log log = LogFactory.getLog(BlockModelCacheInterceptor.class); public BlockModelCacheInterceptor() { } @AroundInvoke @SuppressWarnings(value = unchecked) public Object invoke(final InvocationContext invocation) throws Throwable { log.info(intercepted); return invocation.getTarget(); } } ===The component should be intercepted @Component public class MyBean{ @BlockCachable public void execute() { // do something } } Note: all interceptors were registed in web-beans.xml. When starting Resin, resin produce exceptions. Stacktrace: java.lang.RuntimeException: java.io.FileNotFoundException: \tmp\caucho\qa\temp.class (The system cannot find the path specified) at com.caucho.webbeans.bytecode.InterceptorGenerator.generateProxy (InterceptorGenerator.java:185) at com.caucho.webbeans.bytecode.InterceptorGenerator.gen (InterceptorGenerator.java:80) at com.caucho.webbeans.component.ClassComponent.bind (ClassComponent.java:354) at com.caucho.webbeans.cfg.WbWebBeans.bind(WbWebBeans.java: 276) at com.caucho.webbeans.manager.WebBeansContainer.bind (WebBeansContainer.java:702) at com.caucho.webbeans.manager.WebBeansContainer.environmentStart (WebBeansContainer.java:732) at com.caucho.loader.EnvironmentClassLoader.start (EnvironmentClassLoader.java:567) at com.caucho.server.webapp.WebApp.start(WebApp.java:1798) at com.caucho.server.deploy.DeployController.startImpl (DeployController.java:667) at com.caucho.server.deploy.StartAutoRedeployAutoStrategy.startOnInit (StartAutoRedeployAutoStrategy.java:72) at com.caucho.server.deploy.DeployController.startOnInit (DeployController.java:549) at com.caucho.server.deploy.DeployContainer.start(DeployContainer.java: 160) at com.caucho.server.webapp.WebAppContainer.start(WebAppContainer.java: 675) at com.caucho.server.host.Host.start(Host.java:437) at com.caucho.server.deploy.DeployController.startImpl (DeployController.java:667) at com.caucho.server.deploy.StartAutoRedeployAutoStrategy.startOnInit (StartAutoRedeployAutoStrategy.java:72) at com.caucho.server.deploy.DeployController.startOnInit (DeployController.java:549) at com.caucho.server.deploy.DeployContainer.start(DeployContainer.java: 160) at com.caucho.server.host.HostContainer.start(HostContainer.java:479) at com.caucho.server.cluster.Server.start(Server.java:1171) at com.caucho.server.cluster.Cluster.startServer (Cluster.java:708) at com.caucho.server.cluster.ClusterServer.startServer (ClusterServer.java:529) at com.caucho.server.resin.Resin.start(Resin.java:694) at com.caucho.server.resin.Resin.initMain(Resin.java:1124) at com.caucho.server.resin.Resin.main(Resin.java:1326) 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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) Caused by: java.io.FileNotFoundException: \tmp\caucho\qa\temp.class (The system cannot find the path specified) at java.io.FileOutputStream.open(Native Method) at java.io.FileOutputStream.init(FileOutputStream.java:179) at java.io.FileOutputStream.init(FileOutputStream.java:131) at com.caucho.vfs.FilePath.openWriteImpl(FilePath.java:470) at com.caucho.vfs.Path.openWrite(Path.java:1076) at com.caucho.webbeans.bytecode.InterceptorGenerator.generateProxy (InterceptorGenerator.java:175) ... 29 more java.lang.RuntimeException: java.io.FileNotFoundException: \tmp\caucho\qa\temp.class (The system cannot find the path specified)
[Resin-interest] not a valid database column
Hello, I am trying to make a port of faceCart http://facecart.com shopping platform for resin. Currently faceCart is working under JBoss. I have configured the database driver. I also have persistence.xml everything looks fine except that it says that there is no such column after in the database there is!!! I try to rename the column but still it gives the same error. I tryed to change the default Open JP with hibernate but still the same error. Can you please help me? I am totaly lost. com.caucho.config.ConfigException: 'LANGUAGESID' is not a valid database column in table 'manufacturers_info'. Either the table needs to be created or the create-database-tables attribute must be set. [21:59:11.663] [21:59:11.663] select LANGUAGESID from manufacturers_info where 1=0 [21:59:11.663] [21:59:11.663] com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Unknown column 'LANGUAGESID' in 'field list' [21:59:11.663] at com.caucho.amber.table.Column.error(Column.java:436) [21:59:11.663] at com.caucho.amber.table.Column.validateDatabase(Column.java:315) [21:59:11.663] at com.caucho.amber.table.Table.validateDatabaseTable(Table.java:430) [21:59:11.663] at com.caucho.amber.manager.AmberPersistenceUnit.initTables(AmberPersistenceUnit.java:1378) [21:59:11.663] at com.caucho.amber.manager.AmberPersistenceUnit.generate(AmberPersistenceUnit.java:956) [21:59:11.663] at com.caucho.amber.cfg.PersistenceUnitConfig.init(PersistenceUnitConfig.java:247) [21:59:11.663] at com.caucho.amber.manager.AmberContainer.addPersistenceRoot(AmberContainer.java:580) [21:59:11.663] at com.caucho.amber.manager.PersistenceEnvironmentListener.addLoader(PersistenceEnvironmentListener.java:76) [21:59:11.663] at com.caucho.loader.EnvironmentClassLoader.addLoaderListener(EnvironmentClassLoader.java:411) [21:59:11.663] at com.caucho.loader.Environment.addChildLoaderListener(Environment.java:180) [21:59:11.663] at com.caucho.loader.Environment.addChildLoaderListener(Environment.java:166) [21:59:11.663] at com.caucho.ejb.EJBServer.manualInit(EJBServer.java:738) [21:59:11.663] at com.caucho.ejb.EJBServer.init(EJBServer.java:670) [21:59:11.663] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [21:59:11.663] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [21:59:11.663] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [21:59:11.663] at java.lang.reflect.Method.invoke(Method.java:597) [21:59:11.663] at com.caucho.config.j2ee.PostConstructProgram.configureImpl(PostConstructProgram.java:62) [21:59:11.663] at com.caucho.config.BeanTypeStrategy.init(BeanTypeStrategy.java:382) [21:59:11.663] at com.caucho.config.NodeBuilder.configureChildNode(NodeBuilder.java:411) [21:59:11.663] at com.caucho.config.NodeBuilder.configureNode(NodeBuilder.java:296) [21:59:11.663] at com.caucho.config.NodeBuilder.configureBean(NodeBuilder.java:202) [21:59:11.663] at com.caucho.config.Config.configureBean(Config.java:296) [21:59:11.663] at com.caucho.config.Config.configureBean(Config.java:267) [21:59:11.663] at com.caucho.config.core.ResinImport.init(ResinImport.java:137) [21:59:11.663] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [21:59:11.663] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [21:59:11.663] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [21:59:11.663] at java.lang.reflect.Method.invoke(Method.java:597) [21:59:11.663] at com.caucho.config.j2ee.PostConstructProgram.configureImpl(PostConstructProgram.java:62) [21:59:11.663] at com.caucho.config.BeanTypeStrategy.init(BeanTypeStrategy.java:382) [21:59:11.663] at com.caucho.config.NodeBuilder.configureChildNode(NodeBuilder.java:411) [21:59:11.663] at com.caucho.config.NodeBuilder.configureAttribute(NodeBuilder.java:241) [21:59:11.663] at com.caucho.config.NodeBuilderChildProgram.configureImpl(NodeBuilderChildProgram.java:58) [21:59:11.663] at com.caucho.config.BuilderProgramContainer.configureImpl(BuilderProgramContainer.java:66) [21:59:11.663] at com.caucho.config.BuilderProgram.configure(BuilderProgram.java:68) [21:59:11.663] at com.caucho.server.deploy.EnvironmentDeployController.configureInstance(EnvironmentDeployController.java:388) [21:59:11.663] at com.caucho.server.deploy.EnvironmentDeployController.configureInstance(EnvironmentDeployController.java:61) [21:59:11.663] at com.caucho.server.deploy.DeployController.startImpl(DeployController.java:644) [21:59:11.663] at com.caucho.server.deploy.StartAutoRedeployAutoStrategy.startOnInit(StartAutoRedeployAutoStrategy.java:72) [21:59:11.663] at com.caucho.server.deploy.DeployController.startOnInit(DeployController.java:528) [21:59:11.663] at com.caucho.server.deploy.DeployContainer.start(DeployContainer.java:163) [21:59:11.663] at com.caucho.server.webapp.WebAppContainer.start(WebAppContainer.java:675) [21:59:11.663] at