6 Replies Latest reply on Dec 17, 2012 5:53 AM by feder

    java.lang.OutOfMemoryError: PermGen space when redeploying ( JBoss 7.1.1 )

    jmsjr Newbie

      JBoss 7.1.1 (Brontes)

       

      I have JBoss running on my workstation at the moment for development purposes ( JSF ), so that I constantly redeploy an exploded WAR. I eventually run into an OOM in the PermGem space. Using Java VisualVM, I can see that the graph for PermGen continually rises after each redeployment when touching any file in my exploded WAR ... until it eventually reaches the maximum size for PermGen, which is at 265M.

       

      Has anyone run into this ?

      Granted this is not likely to occur during production, as we would only deploy once every blue moon ... and possibly to be safe, restart JBoss altogether.

      Still, a bit annoying in a development environment.

        • 1. Re: java.lang.OutOfMemoryError: PermGen space when redeploying ( JBoss 7.1.1 )
          Nicklas Karlsson Master

          Here is some information: http://www.integratingstuff.com/2011/07/24/understanding-and-avoiding-the-java-permgen-space-error/

           

          But I also encounter this in development (using hot-deployment like JRebel seems to add to the issue). Also, 7.1.1 is a bit lazy on cleaning up old files (my AS dir is frequently 10+Gb) but I don't think that should eat up mem, only disk. I run my AS on -Xmx4G and perm gen at 1G.

          • 2. Re: java.lang.OutOfMemoryError: PermGen space when redeploying ( JBoss 7.1.1 )
            guinotphil Apprentice

            Hi jmsjr,

             

            Please have a look to my posts in the following threads:

             

            https://community.jboss.org/message/713928

            https://community.jboss.org/message/716769

             

            Regards,

             

            Philippe

            1 of 1 people found this helpful
            • 3. Re: java.lang.OutOfMemoryError: PermGen space when redeploying ( JBoss 7.1.1 )
              jmsjr Newbie

              guinotphil wrote:

               

              Hi jmsjr,

               

              Please have a look to my posts in the following threads:

               

              https://community.jboss.org/message/713928

              https://community.jboss.org/message/716769

               

              Regards,

               

              Philippe

               

              That second link was quite informative ... a few patches applied plus a JVM setting.

              Anyway, glad to know I am not the only one. I can live with this in development, and production deployments will likely require a full restart of JBoss anyway.

               

              Thanks.

              • 4. Re: java.lang.OutOfMemoryError: PermGen space when redeploying ( JBoss 7.1.1 )
                jmsjr Newbie

                BTW .. I am not sure if this is related. Every redeployment also shows up the following in server.log:

                 

                {code}

                20:13:20,637 SEVERE [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-10) Unexpected exception when attempting to tear down the Mojarra runtime: java.lang.NullPointerException

                        at org.richfaces.application.ServiceTracker.release(ServiceTracker.java:132) [richfaces-core-api-4.2.3.Final.jar:4.2.3.Final]

                        at org.richfaces.application.InitializationListener.onStop(InitializationListener.java:137) [richfaces-core-impl-4.2.3.Final.jar:4.2.3.Final]

                        at org.richfaces.application.InitializationListener.processEvent(InitializationListener.java:149) [richfaces-core-impl-4.2.3.Final.jar:4.2.3.Final]

                        at javax.faces.event.SystemEvent.processListener(SystemEvent.java:106) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

                        at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2168) [jsf-impl-2.1.7-jbossorg-2.jar:]

                        at com.sun.faces.application.ApplicationImpl.invokeListenersFor(ApplicationImpl.java:2144) [jsf-impl-2.1.7-jbossorg-2.jar:]

                        at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:302) [jsf-impl-2.1.7-jbossorg-2.jar:]

                        at com.sun.faces.config.ConfigureListener.contextDestroyed(ConfigureListener.java:332) [jsf-impl-2.1.7-jbossorg-2.jar:]

                        at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:3489) [jbossweb-7.0.13.Final.jar:]

                        at org.apache.catalina.core.StandardContext.stop(StandardContext.java:3999) [jbossweb-7.0.13.Final.jar:]

                        at org.jboss.as.web.deployment.WebDeploymentService.stop(WebDeploymentService.java:108) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

                        at org.jboss.msc.service.ServiceControllerImpl$StopTask.stopService(ServiceControllerImpl.java:1911)

                        at org.jboss.msc.service.ServiceControllerImpl$StopTask.run(ServiceControllerImpl.java:1874)

                        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_09]

                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_09]

                        at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_09]

                {code}

                 

                .. that is, it did not do a clean restart.

                • 5. Re: java.lang.OutOfMemoryError: PermGen space when redeploying ( JBoss 7.1.1 )
                  Nikita Salnikov-Tarnovski Newbie

                  I can recommend Plumbr as well. It's functionality includes monitoring for permanent generation leaks as well. And take a look at the blog as well: http://plumbr.eu/blog/. There are some articles about this topic.

                  • 6. Re: java.lang.OutOfMemoryError: PermGen space when redeploying ( JBoss 7.1.1 )
                    feder Newbie

                    Same case here resulting in PermGen OutOfMemoryException.

                     

                    Test Scenario:

                    • JDK6 and 7 (tested both. Same results.)
                    • Deployment method: jboss-as:deploy (jmx)
                    • Deplyoment from: Win7
                    • Deplyoment to: Windows 2008 Server R2
                    • Project: Default RichFaceExample Application (artefactid: org.jboss.tools.example.richfaces)
                    • deployed using jboss-as maven plugin invoking jboss-as:deploy

                     

                    Observation

                    • I successfully deploy and redeploy (24 times) the JBoss Maven HTML5 application (artefactid: org.jboss.tools.example.html5)
                    • I fail to deploy and redeploy the JBoss Richface application (artefactid: org.jboss.tools.example.richfaces)
                    • copying the builded files with an ant task doesn't make any difference (I tried it to ensure that JMX and file-copy deployment results equal).

                     

                    server.log

                     

                    11:42:55,015 INFO  [org.jboss.as.naming] (MSC service thread 1-7) JBAS011802: Starting Naming Service

                    11:42:55,156 INFO  [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-3) JBoss Web Services - Stack CXF Server 4.0.2.GA

                    11:42:55,234 INFO  [org.jboss.as.connector] (MSC service thread 1-6) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.9.Final)

                    11:42:55,437 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-5) JBAS015400: Bound mail session [java:jboss/mail/Default]

                    11:42:56,560 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)

                    11:42:56,841 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)

                    11:42:57,402 INFO  [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-8) Starting Coyote HTTP/1.1 on http--0.0.0.0-8080

                    11:42:57,777 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-7) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]

                    11:42:57,823 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010400: Bound data source [java:jboss/datasources/WinterWheelsDS]

                    11:42:57,995 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-2) JBAS015012: Started FileSystemDeploymentService for directory C:\Users\Administrator\Documents\Software\jboss-as-7.1.1.Final\standalone\deployments

                    11:42:58,073 INFO  [org.jboss.as.remoting] (MSC service thread 1-8) JBAS017100: Listening on /0.0.0.0:9999

                    11:42:58,073 INFO  [org.jboss.as.remoting] (MSC service thread 1-5) JBAS017100: Listening on /0.0.0.0:4447

                    11:42:58,697 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://0.0.0.0:9990

                    11:42:58,713 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss AS 7.1.1.Final "Brontes" started in 10046ms - Started 137 of 213 services (74 services are passive or on-demand)

                    11:50:54,982 INFO  [org.jboss.as.repository] (management-handler-thread - 2) JBAS014900: Content added at location C:\Users\Administrator\Documents\Software\jboss-as-7.1.1.Final\standalone\data\content\5b\ec982ce91111ac4559886d4da80817b00fa176\content

                    11:50:55,028 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-5) JBAS015876: Starting deployment of "RichfacesWebappExample.war"

                    11:50:58,648 INFO  [org.jboss.as.jpa] (MSC service thread 1-6) JBAS011401: Read persistence.xml for primary

                    11:50:59,256 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-6) JBAS018567: Deployment "deployment.RichfacesWebappExample.war" is using a private module ("com.google.guava:main") which may be changed or removed in future versions without notice.

                    11:51:00,005 INFO  [org.jboss.weld.deployer] (MSC service thread 1-6) JBAS016002: Processing weld deployment RichfacesWebappExample.war

                    11:51:00,083 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-6) JNDI bindings for session bean named MemberRegistration in deployment unit deployment "RichfacesWebappExample.war" are as follows:

                     

                        java:global/RichfacesWebappExample/MemberRegistration!org.jboss.tools.example.richfaces.service.MemberRegistration

                        java:app/RichfacesWebappExample/MemberRegistration!org.jboss.tools.example.richfaces.service.MemberRegistration

                        java:module/MemberRegistration!org.jboss.tools.example.richfaces.service.MemberRegistration

                        java:global/RichfacesWebappExample/MemberRegistration

                        java:app/RichfacesWebappExample/MemberRegistration

                        java:module/MemberRegistration

                     

                    11:51:01,783 INFO  [org.jboss.weld.deployer] (MSC service thread 1-6) JBAS016005: Starting Services for CDI deployment: RichfacesWebappExample.war

                    11:51:01,939 INFO  [org.jboss.weld.Version] (MSC service thread 1-6) WELD-000900 1.1.5 (AS71)

                    11:51:02,438 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-6) JBAS010400: Bound data source [jboss/datasources/KitchensinkrfQuickstartDS]

                    11:51:02,438 INFO  [org.jboss.as.jpa] (MSC service thread 1-6) JBAS011402: Starting Persistence Unit Service 'RichfacesWebappExample.war#primary'

                    11:51:03,000 INFO  [org.hibernate.annotations.common.Version] (MSC service thread 1-6) HCANN000001: Hibernate Commons Annotations {4.0.1.Final}

                    11:51:03,062 INFO  [org.hibernate.Version] (MSC service thread 1-6) HHH000412: Hibernate Core {4.0.1.Final}

                    11:51:03,062 INFO  [org.hibernate.cfg.Environment] (MSC service thread 1-6) HHH000206: hibernate.properties not found

                    11:51:03,078 INFO  [org.hibernate.cfg.Environment] (MSC service thread 1-6) HHH000021: Bytecode provider name : javassist

                    11:51:03,172 INFO  [org.hibernate.ejb.Ejb3Configuration] (MSC service thread 1-6) HHH000204: Processing PersistenceUnitInfo [

                        name: primary

                        ...]

                    11:51:04,045 INFO  [org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator] (MSC service thread 1-6) HHH000130: Instantiating explicit connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider

                    11:51:05,200 INFO  [org.hibernate.dialect.Dialect] (MSC service thread 1-6) HHH000400: Using dialect: org.hibernate.dialect.H2Dialect

                    11:51:05,231 WARN  [org.hibernate.dialect.H2Dialect] (MSC service thread 1-6) HHH000431: Unable to determine H2 database version, certain features may not work

                    11:51:05,246 INFO  [org.hibernate.engine.jdbc.internal.LobCreatorBuilder] (MSC service thread 1-6) HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4

                    11:51:05,293 INFO  [org.hibernate.engine.transaction.internal.TransactionFactoryInitiator] (MSC service thread 1-6) HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory

                    11:51:05,324 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (MSC service thread 1-6) HHH000397: Using ASTQueryTranslatorFactory

                    11:51:05,480 INFO  [org.hibernate.validator.util.Version] (MSC service thread 1-6) Hibernate Validator 4.2.0.Final

                    11:51:07,056 INFO  [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-6) HHH000227: Running hbm2ddl schema export

                    11:51:07,118 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-6) HHH000389: Unsuccessful: drop sequence hibernate_sequence

                    11:51:07,118 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-6) Sequenz "HIBERNATE_SEQUENCE" nicht gefunden

                    Sequence "HIBERNATE_SEQUENCE" not found; SQL statement:

                    drop sequence hibernate_sequence [90036-161]

                    11:51:07,134 INFO  [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-6) HHH000230: Schema export complete

                    11:51:07,259 INFO  [org.jboss.weld.deployer] (MSC service thread 1-7) JBAS016008: Starting weld service for deployment RichfacesWebappExample.war

                    11:51:10,176 INFO  [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-4) Mojarra 2.1.7-jbossorg-1 (20120227-1401) für Kontext '/RichfacesWebappExample' wird initialisiert.

                    11:51:35,635 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/RichfacesWebappExample]] (MSC service thread 1-4) Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener: java.lang.OutOfMemoryError: PermGen space

                        at java.lang.Throwable.getStackTraceElement(Native Method) [rt.jar:1.6.0_37]

                        at java.lang.Throwable.getOurStackTrace(Throwable.java:591) [rt.jar:1.6.0_37]

                        at java.lang.Throwable.getStackTrace(Throwable.java:582) [rt.jar:1.6.0_37]

                        at org.jboss.logmanager.formatters.Formatters$12.renderRaw(Formatters.java:383) [jboss-logmanager-1.2.2.GA.jar:1.2.2.GA]

                        at org.jboss.logmanager.formatters.Formatters$JustifyingFormatStep.render(Formatters.java:148) [jboss-logmanager-1.2.2.GA.jar:1.2.2.GA]

                        at org.jboss.logmanager.formatters.MultistepFormatter.format(MultistepFormatter.java:86) [jboss-logmanager-1.2.2.GA.jar:1.2.2.GA]

                        at org.jboss.logmanager.ExtFormatter.format(ExtFormatter.java:35) [jboss-logmanager-1.2.2.GA.jar:1.2.2.GA]

                        at org.jboss.logmanager.handlers.WriterHandler.doPublish(WriterHandler.java:49) [jboss-logmanager-1.2.2.GA.jar:1.2.2.GA]

                        at org.jboss.logmanager.ExtHandler.publish(ExtHandler.java:64) [jboss-logmanager-1.2.2.GA.jar:1.2.2.GA]

                        at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:283) [jboss-logmanager-1.2.2.GA.jar:1.2.2.GA]

                        at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:291) [jboss-logmanager-1.2.2.GA.jar:1.2.2.GA]

                        at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:291) [jboss-logmanager-1.2.2.GA.jar:1.2.2.GA]

                        at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:291) [jboss-logmanager-1.2.2.GA.jar:1.2.2.GA]

                        at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:291) [jboss-logmanager-1.2.2.GA.jar:1.2.2.GA]

                        at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:291) [jboss-logmanager-1.2.2.GA.jar:1.2.2.GA]

                        at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:291) [jboss-logmanager-1.2.2.GA.jar:1.2.2.GA]

                        at org.jboss.logmanager.Logger.logRaw(Logger.java:649) [jboss-logmanager-1.2.2.GA.jar:1.2.2.GA]

                        at org.jboss.logmanager.Logger.log(Logger.java:467) [jboss-logmanager-1.2.2.GA.jar:1.2.2.GA]

                        at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:276) [jsf-impl-2.1.7-jbossorg-2.jar:]

                        at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.13.Final.jar:]

                        at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:]

                        at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

                        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

                        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

                        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_37]

                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_37]

                        at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_37]

                     

                    11:51:35,682 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-4) Error listenerStart

                    11:51:37,398 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-4) Context [/RichfacesWebappExample] startup failed due to previous errors

                    11:51:43,919 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/RichfacesWebappExample]] (MSC service thread 1-4) Exception sending context destroyed event to listener instance of class com.sun.faces.config.ConfigureListener: java.lang.NoClassDefFoundError: com/sun/faces/el/ELContextImpl$VariableMapperImpl

                        at com.sun.faces.config.ConfigureListener.contextDestroyed(ConfigureListener.java:328) [jsf-impl-2.1.7-jbossorg-2.jar:]

                        at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:3489) [jbossweb-7.0.13.Final.jar:]

                        at org.apache.catalina.core.StandardContext.stop(StandardContext.java:3999) [jbossweb-7.0.13.Final.jar:]

                        at org.apache.catalina.core.StandardContext.start(StandardContext.java:3917) [jbossweb-7.0.13.Final.jar:]

                        at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

                        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

                        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

                        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_37]

                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_37]

                        at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_37]

                    Caused by: java.lang.ClassNotFoundException: com.sun.faces.el.ELContextImpl$VariableMapperImpl from [Module "com.sun.jsf-impl:main" from local module loader @38b5dac4 (roots: C:\Users\Administrator\Documents\Software\jboss-as-7.1.1.Final\modules)]

                        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)

                        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

                        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

                        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)

                        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

                        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

                        ... 10 more

                     

                    11:51:48,848 WARN  [org.jboss.modules] (MSC service thread 1-4) Failed to define class org.apache.catalina.deploy.ErrorPage in Module "org.jboss.as.web:main" from local module loader @38b5dac4 (roots: C:\Users\Administrator\Documents\Software\jboss-as-7.1.1.Final\modules): java.lang.OutOfMemoryError: PermGen space

                     

                    11:51:55,229 ERROR [org.jboss.msc] (MSC service thread 1-4) MSC00008: Worker thread Thread[MSC service thread 1-4,5,main] threw an uncaught exception: java.lang.OutOfMemoryError: PermGen space