0 Replies Latest reply on Dec 16, 2005 5:28 AM by jcgagne

    OutOfMemoryError on linux: a workaround

    jcgagne Newbie

      Hi all,

      This is just to report a workaround we found for an OutOfMemoryError that seems to be quite specific to our environment.

      Our application runs on windows for development and integration, and linux for preproduction and production, with almost out-of-the-box configuration.

      The problem appears only on linux.

      distribution : Debian GNU/Linux 3.1 (sarge)
      kernel : 2.4.27-2-686-smp
      RAM: 4 Go
      CPU: bi-pro Intel(R) Xeon(TM) CPU 3.60GHz
      JDK: 1.4.2_08-b03 (Sun Microsystems Inc.) - Java HotSpot(TM) Server VM
      JBoss: 3.2.7(build: CVSTag=JBoss_3_2_7 date=200501280217)

      Under stress test, the number of threads shown on the jboss web console is stable on windows, but increases constantly on linux, quickly reaching the limit and causing an OOMError.

      I don't know why those threads are never disposed, but I know who consumes them all. Before returning a connection out of the pool, the datasource checks if the connection is still alive. Since we use Oracle, this is done by the OracleValidConnectionChecker as suggested. Its "pingDatabase" method starts a new thread at each invocation (why?).

      The workaround is to specify a <check-valid-connection-sql> instead of a <valid-connection-checker-class-name> :

      <check-valid-connection-sql>select 'hello' from dual </check-valid-connection-sql>

      This is just a workaround but it solved our problem.

      Jean-Christian Gagné