2 Replies Latest reply on Sep 9, 2013 7:31 AM by ivom2gi

    java.lang.OutOfMemoryError, datasource connection

    jobame

      While a MDB processes chunks of data (each one in its own transaction) a richFaces poller polls the database every 2 seconds with a simple "find" query. For some reason a "java.sql.SQLException: pingDatabase failed status=-2" is thrown by the DAO used by that poller and successively a java.lang.OutOfMemoryError. I already changed the memory parameters to " -Xms512m -Xmx1024m -XX:MaxPermSize=1024m". Attached is the server log (jboss-as-7.1.1.Final). The server was restarted just 15 minutes before the exception was thrown.

       

      What is going on here? Is the SQLException the cause of the OutOfMemoryError? If yes, why so?

       

      After searching the net there are some hints that the pool configuration could be a cause. We use the following configuration. Would we need a change?

       

      <xa-datasource jta="true" jndi-name="java:/ds_sf_oracle" pool-name="OraclePoolSf" enabled="true" use-java-context="true" use-ccm="true">
          <xa-datasource-property name="URL">
              jdbc:oracle:thin:@hostcrv001001.unix.as24.local:1521:AB23SAFO
          </xa-datasource-property>
          <xa-datasource-property name="User">
              PRODUSER
          </xa-datasource-property>
          <xa-datasource-property name="Password">
              PRODPWD
          </xa-datasource-property>
          <driver>XAoracle</driver>
          <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
          <xa-pool>
              <min-pool-size>10</min-pool-size>
              <max-pool-size>20</max-pool-size>
              <prefill>false</prefill>
              <use-strict-min>true</use-strict-min>
              <flush-strategy>FailingConnectionOnly</flush-strategy>
              <is-same-rm-override>false</is-same-rm-override>
              <interleaving>false</interleaving>
              <no-tx-separate-pools>true</no-tx-separate-pools>
              <pad-xid>false</pad-xid>
          </xa-pool>
          <validation>
              <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker"/>
              <stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker"/>
              <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"/>
          </validation>
          <timeout>
              <set-tx-query-timeout>true</set-tx-query-timeout>
              <blocking-timeout-millis>30000</blocking-timeout-millis>
              <idle-timeout-minutes>30</idle-timeout-minutes>
              <query-timeout>120</query-timeout>
              <use-try-lock>60</use-try-lock>
          </timeout>
      </xa-datasource>
      
        • 1. Re: java.lang.OutOfMemoryError, datasource connection
          wdfink

          You need to investigate what the cause can be.

          Maybe the MDB keep references and produce a memory leak, you should check for ThreadLocal or instance variables which can hold references (i.e. List or Map)

           

          Also the jstat tool will be helpful to show the heap use.

          A OOM Error might also a resource problem that is not releated to the heap, i.e. it will also thrown if it is not possible to create new threads for some reason.

           

          As the stacktrace show a PermGenSpace error is it possible that you have a very huge application?

          • 2. Re: java.lang.OutOfMemoryError, datasource connection
            ivom2gi

            It indeed seems like a potential memory leak. Find out whether it really is by attaching Plumbr. This is a tool for memory leak detection and it also discovers classloader leaks which you seem to be facing. Finding out whether you have a leak is free, the paid plans are only required to see the reason and get solution guidelines.

             

            Full disclosure: I work for the company.