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

    java.lang.OutOfMemoryError, datasource connection

    Dominik Grupp Newbie

      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">
          <xa-datasource-property name="User">
          <xa-datasource-property name="Password">
              <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"/>
        • 1. Re: java.lang.OutOfMemoryError, datasource connection
          Wolf-Dieter Fink Master

          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 Newbie

            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.