Web-application opens connection from JNDI pool, creates PreparedStatements, closes connection without closing statements. Statements are kept open and "ORA-01000: maximum open cursors exceeded" error is thrown. Pool is expected to close statements on connection close. The problem seems to be in src/main/java/org/apache/commons/dbcp2/DelegatingConnection.java, ported from DBCP2. Tomcat version (but not dbcp2 version) contains following code: https://github.com/apache/tomcat/blob/master/java/org/apache/tomcat/dbcp/dbcp2/DelegatingConnection.java#L624 protected void passivate() throws SQLException { ... if (traces != null && traces.isEmpty()) { ^^^^^^^^^^^^^^^^ In DBCP2 version this line has ! before isEmpty(): https://github.com/apache/commons-dbcp/blob/master/src/main/java/org/apache/commons/dbcp2/DelegatingConnection.java#L624 if (traces != null && !traces.isEmpty()) { ^^^
Thanks for the report and the analysis. I did a line by line diff of the entire fork and found one additional issue as well. Fixed in: - master for 9.0.31 onwards - 8.5.x for 8.5.51 onwards