3 Replies Latest reply on Jun 5, 2011 10:32 PM by nbelaevski

    how to handle OutOfMemory error, avoid jboss restart

    javatwo

      When OutOfMemory(Java heap) occurs, how to handle it to avoid JBoss restart?

      I noticed that: once OutOfMemory(Java heap) occurs, GC exception follows. It means GC does not

      have enough memory to perform garbage collection.

       

      For web application, when a session times out, its heap memory needs to be garbage collected.

      Is there a way to ensure enough memory for GC?

       

      Thanks,
      Dave

        • 1. Re: how to handle OutOfMemory error, avoid jboss restart
          nbelaevski

          Dave,

           

          As is known, JSF stores view state in session, so when garbage collection occurs, there is nothing to collect - all states are kept alive.

          Check the following:

           

          1) In some environments sessions can be initiated for each new request - e.g. in HtmlUnit tests

          2) Enable persistent sessions manager so that inactive sessions can be swapped to disc

          3) Decrease size of view state - check for keep-alived objects, Seam scopes contents, etc.

          • 2. Re: how to handle OutOfMemory error, avoid jboss restart
            javatwo

            Hi Nick, thanks for your reply.

             

            What is the main purpose of Number 2?  If a session is inactive, it will be invalidated on timeout.

             

            For long session, how to enable persistent sessions? Can I set timeout for swapping out to disk? like 10 minutes.

            Currently our web application can allow maximum 100 http sessions for 2G heap size. Session timeout is 30 minutes.

            We like to increase concurrent session count to 1000 without increasing heap size.

             

            Thanks

            Dave

            • 3. Re: how to handle OutOfMemory error, avoid jboss restart
              nbelaevski

              Dave,

               

              Check application server documentation for configuration details.