Uploaded image for project: 'Commons DBCP'
  1. Commons DBCP
  2. DBCP-512

Avoid exceptions when closing a connection in mutli-threaded use case.

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5.0
    • Labels:
      None

      Description

      Avoid exceptions when closing a connection in mutli-threaded use case.

      For example:

      11:56:34,397 WARN  [arjuna] ARJUNA012108: CheckedAction::check - atomic action 0:ffffc0a86301:df08:5b42504f:1d078 aborting with 1 threads active!
      11:56:34,397 WARN  [arjuna] ARJUNA012077: Abort called on already aborted atomic action 0:ffffc0a86301:df08:5b42504f:1d078
      11:56:34,416 WARN  [arjuna] ARJUNA012121: TransactionReaper::doCancellations worker Thread[Transaction Reaper Worker 0,5,main] successfully canceled TX 0:ffffc0a86301:df08:5b42504f:1d078
      Pooled object created 2018-07-08 11:56:34 -0600 by the following code has not been returned to the pool:
      org.apache.commons.pool2.impl.ThrowableCallStack$Snapshot
              at org.apache.commons.pool2.impl.ThrowableCallStack.fillInStackTrace(ThrowableCallStack.java:71)
              at org.apache.commons.pool2.impl.DefaultPooledObject.allocate(DefaultPooledObject.java:193)
              at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:459)
              at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:365)
              at org.apache.commons.dbcp2.managed.ManagedConnection.updateTransactionStatus(ManagedConnection.java:142)
              at org.apache.commons.dbcp2.managed.ManagedConnection.<init>(ManagedConnection.java:75)
              at org.apache.commons.dbcp2.managed.ManagedDataSource.getConnection(ManagedDataSource.java:80)
              at org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1563)
              at org.apache.commons.dbcp2.managed.TestConnectionWithNarayana.testConnectionInTimeout(TestConnectionWithNarayana.java:158)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:498)
              at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
              at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
              at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
              at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
              at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
              at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
              at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
              at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
              at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
              at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
              at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
              at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
              at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
              at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
              at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
              at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
              at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
              at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
              at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
              at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:383)
              at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:344)
              at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:125)
              at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:417)
      org.h2.jdbc.JdbcSQLException: The database has been closed [90098-197]
              at org.h2.message.DbException.getJdbcSQLException(DbException.java:357)
              at org.h2.message.DbException.get(DbException.java:179)
              at org.h2.message.DbException.get(DbException.java:155)
              at org.h2.message.DbException.get(DbException.java:144)
              at org.h2.engine.Database.checkPowerOff(Database.java:536)
              at org.h2.engine.Session.close(Session.java:877)
              at org.h2.jdbc.JdbcConnection.close(JdbcConnection.java:411)
              at org.apache.commons.dbcp2.DelegatingConnection.closeInternal(DelegatingConnection.java:228)
              at org.apache.commons.dbcp2.PoolableConnection.reallyClose(PoolableConnection.java:232)
              at org.apache.commons.dbcp2.managed.PoolableManagedConnection.reallyClose(PoolableManagedConnection.java:79)
              at org.apache.commons.dbcp2.PoolableConnectionFactory.destroyObject(PoolableConnectionFactory.java:367)
              at org.apache.commons.pool2.impl.GenericObjectPool.destroy(GenericObjectPool.java:921)
              at org.apache.commons.pool2.impl.GenericObjectPool.invalidateObject(GenericObjectPool.java:626)
              at org.apache.commons.pool2.impl.GenericObjectPool.removeAbandoned(GenericObjectPool.java:1056)
              at org.apache.commons.pool2.impl.GenericObjectPool.evict(GenericObjectPool.java:809)
              at org.apache.commons.pool2.impl.BaseGenericObjectPool$Evictor.run(BaseGenericObjectPool.java:1111)
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
              at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
              at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
              at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
              at java.lang.Thread.run(Thread.java:748)
      

        Attachments

          Activity

            People

            • Assignee:
              ggregory Gary D. Gregory
              Reporter:
              ggregory Gary D. Gregory
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: