tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jean Pierre Urkens" <>
Subject DB Connection pool returns stale connections
Date Thu, 20 Jul 2017 10:03:29 GMT
Hi All,


I'm running Tomcat-8.-5.15 with following Oracle datasource definition:

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

                                             username="xxx" password="yyy"

                                            maxTotal="10" maxIdle="10"

removeAbandonedTimeout="120" logAbandoned="true"

                                            validationQuery="select sysdate
from dual" testOnBorrow="true"/>


Tomcat is using the ojdbc6.jar driver library to connect to an Oracle 12c DB
instance. Initially this datasource declaration seems to work fine.

However when resuming a HTTP session after a period of inactivity the
database pool seems to return stale DB connections. The log file shows

entries like:


[IDP] 2017-07-20 11:28:35,655 [T8N2TP1-13] DEBUG $--$
(be.xm.base.database.DBPoolManager:141) - Connection: 502672209,
URL=jdbc:oracle:thin:@zzz:1521:SID, UserName=xxx, Oracle JDBC driver

[IDP] 2017-07-20 11:28:35,656 [T8N2TP1-13] DEBUG $--$
(org.hibernate.impl.SessionImpl:221) - opened session at timestamp:

[IDP] 2017-07-20 11:28:35,657 [T8N2TP1-13] DEBUG $--$
(org.hibernate.jdbc.AbstractBatcher:389) - about to open PreparedStatement
(open PreparedStatements: 0, globally: 0)

[IDP] 2017-07-20 11:28:35,657 [T8N2TP1-13] DEBUG $--$
(org.hibernate.jdbc.ConnectionManager:421) - opening JDBC connection

[IDP] 2017-07-20 11:28:54,802 [T8N2TP1-13] DEBUG $--$
(org.hibernate.jdbc.AbstractBatcher:424) - select this_.PERSOONID as
PERSOONID2_0_, this_.rrn as rrn2_0_ from APP_ID_P_RRN.PERSOON this_ where
(this_.rrn like ?)


There is almost 20 seconds between opening the JDBC connection and
effectively sending the SQL query. Now the standard HTTP connector in Tomcat
is configured with a connectionTimeout=20000 which in this

situation will cause the request to fail.


Why does opening the JDBC connection takes so long? Is this an indication
that the DBConnection returned by the DBCP is stale and if so why didn't the
pool cleaned up this connection itself?




Met vriendelijke groet,

Jean Pierre Urkens

System Architect

Adv. Dev and Cloud Integration

 <tel:+32+14+722162> +32 (0)14 722162

 <tel:+32+478+838336> +32 (0)478 838336






Maatschappelijke zetel Devoteam NV/SA

Belgicastraat 17  - 1930 Zaventem
VAT: BE 0466.475.275  /  RPM Bruxelles - RPR Brussel



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