2 Replies Latest reply on Mar 24, 2012 7:39 AM by Randahl Fink Isaksen

    AS7 OutOfMemoryError during deployment of trivial app

    Randahl Fink Isaksen Novice

      I have been troubled by this OutOfMemoryError all day. It occurs when let Maven deploy my fairly simple ear to AS7 using the jboss-as-maven-plugin.

       

      The weird thing is, my application has been working fine all week and then this morning when I added a servlet and refactored two of my EJBs, I suddenly could not deploy anymore. Either the maven deployment plugin hangs or I get the OutOfMemoryError shown below this message.

       

      Now I am on an 8 GB machine, so I have tried reserving more memory for my IDE and for JBoss.

       

      I increasing the memory of NetBeans by adding the following to netbeans.conf: netbeans_default_options="-J-Xmx1024m -J-XX:MaxPermSize=1024m" but that had no effect – maven still fails.

      Then, realizing that the error might actually come from JBoss AS I tried increasing JBoss AS7's memory by configuring

        JAVA_OPTS="-Xms64m -Xmx1024m -XX:MaxPermSize=1024m

      That too had no effect.

       

      I am really puzzled by this, so any hints to things I could try would be highly appreciated.

       

      Thanks

       

      Randahl

       

       

      ------------------------------------

      Exception seen in IDE console when deploying:

       

      INFO: JBoss Remoting version 3.2.2.GA

      Exception in thread "management-client-thread 1-2" java.lang.OutOfMemoryError: Java heap space

                at java.util.Arrays.copyOf(Arrays.java:2786)

                at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:94)

                at org.jboss.as.protocol.StreamUtils.copyStream(StreamUtils.java:49)

                at org.jboss.as.controller.client.impl.AbstractModelControllerClient$ReadAttachmentInputStreamRequestHandler.copyStream(AbstractModelControllerClient.java:226)

                at org.jboss.as.controller.client.impl.AbstractModelControllerClient$ReadAttachmentInputStreamRequestHandler$1.execute(AbstractModelControllerClient.java:202)

                at org.jboss.as.protocol.mgmt.AbstractMessageHandler$2$1.doExecute(AbstractMessageHandler.java:287)

                at org.jboss.as.protocol.mgmt.AbstractMessageHandler$AsyncTaskRunner.run(AbstractMessageHandler.java:483)

                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:680)

                at org.jboss.threads.JBossThread.run(JBossThread.java:122)

       

       

       

       

       

      -----------------------------------

      The JBoss console does not output anything. Only later when I terminate maven's deployment thread I get this from JBoss:

       

      20:14:34,040 ERROR [org.jboss.as.controller.management-operation] (management-handler-threads - 1) JBAS014612: Operation ("add") failed - address: ([("deployment" => "wefend-server.ear")]): java.lang.RuntimeException: JBAS014761: Thread was interrupted waiting to read attachment input stream from remote caller

                at org.jboss.as.controller.remote.OperationAttachmentsProxy$ProxiedInputStream.read(OperationAttachmentsProxy.java:111) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final]

                at java.io.InputStream.read(InputStream.java:151) [classes.jar:1.6.0_29]

                at java.io.BufferedInputStream.read1(BufferedInputStream.java:256) [classes.jar:1.6.0_29]

                at java.io.BufferedInputStream.read(BufferedInputStream.java:317) [classes.jar:1.6.0_29]

                at java.io.FilterInputStream.read(FilterInputStream.java:90) [classes.jar:1.6.0_29]

                at org.jboss.as.repository.ContentRepository$Factory$ContentRepositoryImpl.addContent(ContentRepository.java:150)

                at org.jboss.as.server.deployment.DeploymentAddHandler.addFromContentAdditionParameter(DeploymentAddHandler.java:189)

                at org.jboss.as.server.deployment.DeploymentAddHandler.execute(DeploymentAddHandler.java:156)

                at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:387) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final]

                at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:274) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final]

                at org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:202) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final]

                at org.jboss.as.controller.CompositeOperationHandler.execute(CompositeOperationHandler.java:85) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final]

                at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:387) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final]

                at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:274) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final]

                at org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:202) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final]

                at org.jboss.as.controller.ModelControllerImpl$DefaultPrepareStepHandler.execute(ModelControllerImpl.java:461) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final]

                at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:387) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final]

                at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:274) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final]

                at org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:202) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final]

                at org.jboss.as.controller.ModelControllerImpl.execute(ModelControllerImpl.java:121) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final]

                at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler.doExecute(ModelControllerClientOperationHandler.java:139) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final]

                at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler$1.execute(ModelControllerClientOperationHandler.java:108) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final]

                at org.jboss.as.protocol.mgmt.AbstractMessageHandler$2$1.doExecute(AbstractMessageHandler.java:287) [jboss-as-protocol-7.1.0.Final.jar:7.1.0.Final]

                at org.jboss.as.protocol.mgmt.AbstractMessageHandler$AsyncTaskRunner.run(AbstractMessageHandler.java:483) [jboss-as-protocol-7.1.0.Final.jar:7.1.0.Final]

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

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

                at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_29]

                at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.0.0.GA.jar:2.0.0.GA]

       

       

      20:14:34,051 ERROR [org.jboss.as.protocol] (management-handler-threads - 1)  failed to process async request for org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler$1@44c8cc on channel Channel ID 67fe454b (inbound) of Remoting connection 01daf346 to null: org.jboss.remoting3.NotOpenException: Writes closed

                at org.jboss.remoting3.remote.RemoteConnectionChannel.openOutboundMessage(RemoteConnectionChannel.java:107) [jboss-remoting-3.2.2.GA.jar:3.2.2.GA]

                at org.jboss.remoting3.remote.RemoteConnectionChannel.writeMessage(RemoteConnectionChannel.java:296) [jboss-remoting-3.2.2.GA.jar:3.2.2.GA]

                at org.jboss.as.protocol.mgmt.AbstractMessageHandler$2.writeMessage(AbstractMessageHandler.java:303) [jboss-as-protocol-7.1.0.Final.jar:7.1.0.Final]

                at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler$1.execute(ModelControllerClientOperationHandler.java:113) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final]

                at org.jboss.as.protocol.mgmt.AbstractMessageHandler$2$1.doExecute(AbstractMessageHandler.java:287) [jboss-as-protocol-7.1.0.Final.jar:7.1.0.Final]

                at org.jboss.as.protocol.mgmt.AbstractMessageHandler$AsyncTaskRunner.run(AbstractMessageHandler.java:483) [jboss-as-protocol-7.1.0.Final.jar:7.1.0.Final]

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

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

                at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_29]

                at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.0.0.GA.jar:2.0.0.GA]

       

       

       

       

       

      -----------------------------------

      It should be clear that JBoss has plenty of memory, since this is shown during startup:

        JBoss Bootstrap Environment

       

        JBOSS_HOME: /Users/randahl/Dropbox/Development/jboss-as-7.1.0.Final

       

        JAVA: java

       

        JAVA_OPTS: -d32 -client -Xms64m -Xmx1024m -XX:MaxPermSize=1024m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.server.default.config=standalone.xml

        • 1. Re: AS7 OutOfMemoryError during deployment of trivial app
          Scott Marlow Master

          Can you reproduce with AS 7.1.1 (was released recently)?  You also try the nightly AS7 build as well.  If that helps, your done.

           

          Perhaps someone will recognize the problem but if not, you might want to run your netbeans with the -XX:-HeapDumpOnOutOfMemoryError option to generate a heapdump when the OOM occurs.  If the OOM occurs in a launched process, you might have to configure the -XX:-HeapDumpOnOutOfMemoryError for the launched process.

           

          If you can get the -XX:-HeapDumpOnOutOfMemoryError option on the JVM that experiences the out of memory, then a Java heap dump file will be generated.  Opening the generated .hprof file with the Eclipse Memory Analyzer (or your favorite memory tool) will bring you down the path of understanding what was the biggest object in memory at the time of OOM.

           

          Perhaps others will have different suggestions but learning how to use the Eclipse Memory Analyzer should be useful for other reaons (you will see what I mean when you use it).

           

          Scott

          1 of 1 people found this helpful
          • 2. Re: AS7 OutOfMemoryError during deployment of trivial app
            Randahl Fink Isaksen Novice

            Problem solved. This was not a JBoss remoting problem. This was caused by the fact that NetBeans launches maven in its own process and that process did not have enough memory. I solved this by adding the following to netbeans.conf:

             

            export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=128m"