tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Knoblauch <kn...@knobisoft.de>
Subject Tomcat JDBC Pool memory leak when using StatementFinalizer interceptor
Date Wed, 11 Jul 2018 14:22:40 GMT
Hi,

 while analyzing some heap dump for other reasons, I found that our
application is apparently aggregating a considerable amount of memory in
"org.apache.tomcat.jdbc.pool.TrapException", which is never cleaned by GC.
Digging deeper, it seems that the entries of the "statements" linked list
in the StatementFinalizer are never removed from the list, so after three
weeks of lifetime one ends up with a list of 7 million entries, each 80
bytes.

 Now it might be, that we are just using the StatementFinalizer in a wrong
manner. And what we see is expected behavior. Below is our pool
configuration. Maybe something is just missing :-)

We are at Tomcat 8.0.36 (yeah, I know, but that is the version we have to
use) and Java 8 (1.8.0_171). Underlying DB is Oracle 12.1.0.2 and we are
using the latest "ojdbc7.jar" from Oracle.


            <Resource
                name="jdbc/SimManagerDS"
                auth="Container"

                type="javax.sql.DataSource"
                description="Oracle datasource for xxxxxxx using
tomcat.jdbc.pool"
                factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
                jmxEnabled="true"

jdbcInterceptors="ConnectionState;StatementFinalizer;ResetAbandonedTimer;StatementCache(prepared=true,max=200)"

                initialSize="7"
                minIdle="7"
                maxActive="30"
                maxIdle="10"

                testWhileIdle="true"
                testOnBorrow="true"
                testOnConnect="false"
                testOnReturn="false"
                validationQuery="SELECT 1 from dual"
                validationInterval="30000"

                logAbandoned="true"
                removeAbandoned="false"
                removeAbandonedTimeout="0"
                suspectTimeout="600"

                timeBetweenEvictionRunsMillis="30000"
                minEvictableIdleTimeMillis="60000"
                maxWait="60000"
                maxAge="0"

                connectionProperties="(defaultRowPrefetch=200)"

                driverClassName="oracle.jdbc.OracleDriver"
                url="jdbc:oracle:thin:@s#######"
                username="########"
                password="########"
           />

Thanks
Martin
-- 
------------------------------------------------------
Martin Knoblauch
email: k n o b i AT knobisoft DOT de
www: http://www.knobisoft.de

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message