[weld-issues] [JBoss JIRA] Commented: (WELD-476) OutOfMemory Exception When Deploying (Bootstrapping) Single BDA with 621 classes

David Allen (JIRA) jira-events at lists.jboss.org
Thu May 6 06:31:05 EDT 2010


    [ https://jira.jboss.org/jira/browse/WELD-476?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12529332#action_12529332 ] 

David Allen commented on WELD-476:
----------------------------------

This is a good example of an application where many managed beans are components of a framework that uses class extension to provide common behaviors.  When Weld deploys such an application, it first needs to introspect each class and build complex object graphs that provide class reflection data.

In this case, the majority of beans extend framework classes which in turn extends other framework classes such that each bean contains many methods, constructors, and fields.  In Weld, the introspection process recreates almost all of these framework methods, constructors, and fields for each bean.  In short, approximately 1GB or a little more is necessary to store the class reflection data for the managed beans in this Wicket Examples application.

To workaround this problem, simply provide GF or JBoss AS with sufficient heap space to do its work.  This application did deploy in JBoss AS with 1.5GB of heap space.

Future versions of Weld should concentrate on not reflecting the same classes repeatedly as is currently done.  Each class in a hierarchy should be reflected at most once.  There are also many sets used where ArrayLists would be more efficient since they can be truncated to fit the data or initialized to the proper size to begin with.  Currently there are many underlying hashmaps where only a single entry exists.  The entry tables for these hashmaps consume 31% of the heap space alone while the entries themselves account for only 14% of the heap.

By mirroring the class hierarchy in the reflection objects generated, the space requirements for such framework applications can be reduced  significantly.  Additional analysis should also be done on how this information is actually used to determine how best to design these object graphs for efficient use during bean construction.

> OutOfMemory Exception When Deploying (Bootstrapping) Single BDA with 621 classes
> --------------------------------------------------------------------------------
>
>                 Key: WELD-476
>                 URL: https://jira.jboss.org/jira/browse/WELD-476
>             Project: Weld
>          Issue Type: Bug
>          Components: Bootstrap and Metamodel API
>    Affects Versions: 1.0.1.Final
>         Environment: GlassFish v3.01 Macos w/ 4 GB memory
>            Reporter: Roger Kitain
>            Assignee: David Allen
>         Attachments: WicketExamples.war
>
>
> Upon deploying a war with WEB-INF/beans.xml and 621 classes under WEB-INF/classes, an outofmemory exception is produced:
> org.glassfish.deployment.common.DeploymentException: java.lang.OutOfMemoryError: Java heap space
> 	at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:167)
> 	at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:125)
> 	at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:224)
> 	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:338)
> 	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:183)
> 	at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:272)
> 	at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:310)
> 	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:320)
> 	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1176)
> 	at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$900(CommandRunnerImpl.java:83)
> 	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235)
> 	at org.glassfish.deployment.autodeploy.AutoOperation.run(AutoOperation.java:141)
> 	at org.glassfish.deployment.autodeploy.AutoDeployer.deploy(AutoDeployer.java:573)
> 	at org.glassfish.deployment.autodeploy.AutoDeployer.deployAll(AutoDeployer.java:459)
> 	at org.glassfish.deployment.autodeploy.AutoDeployer.run(AutoDeployer.java:391)
> 	at org.glassfish.deployment.autodeploy.AutoDeployer.run(AutoDeployer.java:376)
> 	at org.glassfish.deployment.autodeploy.AutoDeployService$1.run(AutoDeployService.java:195)
> 	at java.util.TimerThread.mainLoop(Timer.java:512)
> 	at java.util.TimerThread.run(Timer.java:462)
> Caused by: com.google.common.collect.ComputationException: java.lang.OutOfMemoryError: Java heap space
> 	at com.google.common.collect.MapMaker$StrategyImpl.compute(MapMaker.java:602)
> 	at com.google.common.collect.MapMaker$StrategyImpl.compute(MapMaker.java:462)
> 	at com.google.common.collect.CustomConcurrentHashMap$ComputingImpl.get(CustomConcurrentHashMap.java:2045)
> 	at org.jboss.weld.resources.ClassTransformer.loadClass(ClassTransformer.java:164)
> 	at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:61)
> 	at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:88)
> 	at org.jboss.weld.bootstrap.BeanDeployment.deployBeans(BeanDeployment.java:134)
> 	at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:377)
> 	at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:165)
> 	... 18 more
> Caused by: java.lang.OutOfMemoryError: Java heap space
> 	at java.lang.Class.copyMethods(Class.java:2745)
> 	at java.lang.Class.getDeclaredMethods(Class.java:1791)
> 	at org.jboss.weld.util.reflection.SecureReflections$8.work(SecureReflections.java:197)
> 	at org.jboss.weld.util.reflection.SecureReflections$8.work(SecureReflections.java:193)
> 	at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
> 	at org.jboss.weld.util.reflection.SecureReflectionAccess.runAndWrap(SecureReflectionAccess.java:67)
> 	at org.jboss.weld.util.reflection.SecureReflections.getDeclaredMethods(SecureReflections.java:192)
> 	at org.jboss.weld.introspector.jlr.WeldClassImpl.<init>(WeldClassImpl.java:282)
> 	at org.jboss.weld.introspector.jlr.WeldClassImpl.of(WeldClassImpl.java:140)
> 	at org.jboss.weld.resources.ClassTransformer$TransformTypeToWeldClass.apply(ClassTransformer.java:50)
> 	at org.jboss.weld.resources.ClassTransformer$TransformTypeToWeldClass.apply(ClassTransformer.java:38)
> 	at com.google.common.collect.MapMaker$StrategyImpl.compute(MapMaker.java:592)
> 	at com.google.common.collect.MapMaker$StrategyImpl.compute(MapMaker.java:462)
> 	at com.google.common.collect.CustomConcurrentHashMap$ComputingImpl.get(CustomConcurrentHashMap.java:2045)
> 	at org.jboss.weld.resources.ClassTransformer.loadClass(ClassTransformer.java:164)
> 	at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:61)
> 	at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:88)
> 	at org.jboss.weld.bootstrap.BeanDeployment.deployBeans(BeanDeployment.java:134)
> 	at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:377)
> 	at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:165)
> 	at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:125)
> 	at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:224)
> 	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:338)
> 	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:183)
> 	at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:272)
> 	at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:310)
> 	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:320)
> 	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1176)
> 	at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$900(CommandRunnerImpl.java:83)
> 	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235)
> 	at org.glassfish.deployment.autodeploy.AutoOperation.run(AutoOperation.java:141)
> 	at org.glassfish.deployment.autodeploy.AutoDeployer.deploy(AutoDeployer.java:573)
> There is nothing special about the BDA passed to weld - a single BDA with 621 classes.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the weld-issues mailing list