In case of dataSource.setEnableAutoCommitOnReturn(isAutocommit()) issue is still reproducible.
There is bigger problem, I've made some investigation with Derby + Jmeter and realize that autoCommit=false works correct only with Excalibur (2.13 version) In case of enableAutoCommitOnReturn we've got autoCommit=true for any connection (even if it was defined as false). rollbackOnReturn also doesn't work well (And it's strange) On connection validation step, statement evaluation occurs and looks like it create transaction that prevent connection close and leads to this exception. Sorry for probably that nonsense, I don't have much experience with jmeter or dbcp2 :) Here is full stack trace: java.sql.SQLException: Cannot create PoolableConnectionFactory (Cannot close a connection while a transaction is still active.) at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2385) at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2110) at org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1563) at org.apache.jmeter.protocol.jdbc.config.DataSourceElement$DataSourceComponentImpl.getConnection(DataSourceElement.java:361) at org.apache.jmeter.protocol.jdbc.config.DataSourceElement.getConnection(DataSourceElement.java:197) at org.apache.jmeter.protocol.jdbc.sampler.JDBCSampler.sample(JDBCSampler.java:79) at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:627) at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:551) at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:490) at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:257) at java.lang.Thread.run(Thread.java:748) Caused by: java.sql.SQLException: Cannot close a connection while a transaction is still active. at org.apache.derby.client.am.SQLExceptionFactory.getSQLException(Unknown Source) at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source) at org.apache.derby.client.am.ClientConnection.closeResourcesX(Unknown Source) at org.apache.derby.client.am.ClientConnection.closeX(Unknown Source) at org.apache.derby.client.am.ClientConnection.close(Unknown Source) at org.apache.derby.client.net.NetConnection.close(Unknown Source) at org.apache.commons.dbcp2.DelegatingConnection.closeInternal(DelegatingConnection.java:239) at org.apache.commons.dbcp2.PoolableConnection.reallyClose(PoolableConnection.java:232) at org.apache.commons.dbcp2.PoolableConnectionFactory.destroyObject(PoolableConnectionFactory.java:367) at org.apache.commons.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:2402) at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2381) ... 10 more Caused by: ERROR 25001: Cannot close a connection while a transaction is still active. at org.apache.derby.client.am.ClientConnection.checkForTransactionInProgress(Unknown Source) ... 19 more On Wed, Dec 18, 2019 at 1:01 AM Philippe Mouawad <[email protected]> wrote: > My proposal was in case we don't add ability to configure it. > > So ok by me with Vladimir's proposal although it should be documented that > settings are kind of related. > > On Tue, Dec 17, 2019 at 10:45 PM Dmitry Sherstobitov <[email protected]> > wrote: > > > Philippe, > > > > I don't think this will be the correct solution. It's still hardcoded in > > this case and strictly depends on autoCommit which is not obvious. > > > > I agree with Vladimir - this should be configurable. > > > > On Wed, Dec 18, 2019 at 12:07 AM Vladimir Sitnikov < > > [email protected]> wrote: > > > > > Philippe>dataSource.setEnableAutoCommitOnReturn(isAutocommit()); > > > > > > What do you think of adding a checkbox like "rollback on returning > > > connections to the pool"? > > > > > > Dmitry>I've created issue. Currently I can't find solution for that > > without > > > Dmitry>changing source code :( > > > > > > I guess it would make sense to make it configurable. > > > > > > Vladimir > > > > > > > > > -- > > ------------------ > > Best regards, > > Dmitry Sherstobitov > > > > > -- > Cordialement. > Philippe Mouawad. > -- ------------------ Best regards, Dmitry Sherstobitov
