set the properties

logAbandoned="true"
removeAbandoned="true"
removeAbandonedTimeout="60" (value is in seconds, should be larger than
your longest running transaction)
timeBetweenEvictionRunsMillis="15000" (value is in milliseconds)

if you have a leak (meaning your code is not returning the connections) you
will see log entries
​ that clearly detail the stack trace of where the problem occurred

an abandoned connection is a connection where you called
DataSource.getConnection() and then never called Connection.close() on

Filip
​


On Thu, Jun 11, 2015 at 6:18 PM, Douglas Schaible <doug...@mac.com> wrote:

> Good Day All,
>
> I am having a problem with a connection pool and I was hoping for some
> guidance.
>
> I have defined the connection pool below for two deployed applications to
> use.  When I bounce the server I can see that it immediately crates 100
> connections to the DB.  (I am ok with this, but that is not what is
> specified in the config)  Then when I access the application repeatedly
> very quickly new connections to the DB are created each time a page is
> called till it reaches about 150 and then future calls fail with the
> message
> "com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Too
> many connections” logged by the server.
>
> If we don’t place any extra load on the server the number of connections
> to the DB are reduced to 1 or 2 after 24 hours and you get the error
> "Timeout: Pool empty. Unable to fetch a connection in 30 seconds, none
> available[size:100; busy:100; idle:0; lastwait:30000].” from one of the
> applications and the other application continues to work just fine.
>
> I believe that the DB, MySQL, is dropping the connection, but tomcat does
> not know that it has been dropped.
>
> I am looking for some guidance on how to tune this configuration.  Any
> suggestions?
>
>
>
>  <Resource
>            name="jdbc/PDB"
>            auth="Container"
>            type="javax.sql.DataSource"
>            factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
>            initialSize="10"
>            maxTotal="100"
>            maxIdle="5"
>            maxWaitMillis="10000"
>            username=“xxxxxx"
>            password=“xxxxxx"
>            driverClassName="com.mysql.jdbc.Driver"
>            url="jdbc:mysql://xxxxx.xxxxxx.us-east-1.rds.amazonaws.com”/>
>
>
> Server version:        Apache Tomcat/8.0.20
> Server number:         8.0.20.0
> OS Name:               Linux
> OS Version:            3.14.35-28.38.amzn1.x86_64
> Architecture:          amd64
> JVM Version:           1.7.0_79-mockbuild_2015_04_22_23_18-b00
> JVM Vendor:            Oracle Corporation
>
> Thanks,
> Doug
>
>

Reply via email to