5

我正在使用带有光滑的 Bonecp 数据源。发现池包含关闭的连接所以我总是遇到这个异常

java.sql.SQLException: Connection is closed!
    at com.jolbox.bonecp.ConnectionHandle.checkClosed(ConnectionHandle.java:459) ~[bonecp-0.8.0-rc3.jar:na]
    at com.jolbox.bonecp.ConnectionHandle.prepareStatement(ConnectionHandle.java:1180) ~[bonecp-0.8.0-rc3.jar:na]
    at scala.slick.session.Session$class.prepareStatement(Session.scala:29) ~[slick_2.10-1.0.1.jar:1.0.1]
    at scala.slick.session.BaseSession.prepareStatement(Session.scala:201) ~[slick_2.10-1.0.1.jar:1.0.1]
    at scala.slick.jdbc.StatementInvoker.results(StatementInvoker.scala:29) ~[slick_2.10-1.0.1.jar:1.0.1]
    at scala.slick.jdbc.StatementInvoker.elementsTo(StatementInvoker.scala:17) ~[slick_2.10-1.0.1.jar:1.0.1]
    at scala.slick.jdbc.Invoker$class.elements(Invoker.scala:20) ~[slick_2.10-1.0.1.jar:1.0.1]
    at scala.slick.jdbc.StatementInvoker.elements(StatementInvoker.scala:10) ~[slick_2.10-1.0.1.jar:1.0.1]
    at scala.slick.jdbc.Invoker$class.execute(Invoker.scala:33) ~[slick_2.10-1.0.1.jar:1.0.1]
    at scala.slick.jdbc.StatementInvoker.execute(StatementInvoker.scala:10) ~[slick_2.10-1.0.1.jar:1.0.1]
    at scala.slick.jdbc.UnitInvoker$class.execute(Invoker.scala:158) ~[slick_2.10-1.0.1.jar:1.0.1]
    at scala.slick.jdbc.StaticQuery0.execute(StaticQuery.scala:95) ~[slick_2.10-1.0.1.jar:1.0.1]
    at com.livestream.sql.table.MySqlTable.replace(MySqlTable.scala:31) ~[util-core_2.10-1.0.0.jar:1.0.0]
    at com.livestream.isilon.crawler.IsilonAssetCrawler$$anonfun$run$3.apply(IsilonAssetCrawler.scala:245) ~[isilon-asset-cleanup_2.10-1.0.0.jar:1.0.0]
    at com.livestream.isilon.crawler.IsilonAssetCrawler$$anonfun$run$3.apply(IsilonAssetCrawler.scala:244) ~[isilon-asset-cleanup_2.10-1.0.0.jar:1.0.0]
    at scala.slick.session.Database.withSession(Database.scala:38) ~[slick_2.10-1.0.1.jar:1.0.1]
    at com.livestream.isilon.crawler.IsilonAssetCrawler.run(IsilonAssetCrawler.scala:244) ~[isilon-asset-cleanup_2.10-1.0.0.jar:1.0.0]
    at com.livestream.isilon.crawler.IsilonAssetCrawler.run(IsilonAssetCrawler.scala:31) ~[isilon-asset-cleanup_2.10-1.0.0.jar:1.0.0]
    at com.livestream.util.task.TaskHttpApi$$anon$1$$anonfun$1$$anonfun$apply$1.apply(TaskHttpApi.scala:49) ~[workflow-core_2.10-1.0.0.jar:1.0.0]
    at com.livestream.util.task.TaskHttpApi$$anon$1$$anonfun$1$$anonfun$apply$1.apply(TaskHttpApi.scala:47) ~[workflow-core_2.10-1.0.0.jar:1.0.0]
    at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) ~[scala-library-2.10.3.jar:na]
    at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) ~[scala-library-2.10.3.jar:na]
    at scala.concurrent.impl.ExecutionContextImpl$$anon$3.exec(ExecutionContextImpl.scala:107) ~[scala-library-2.10.3.jar:na]
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) ~[scala-library-2.10.3.jar:na]
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) ~[scala-library-2.10.3.jar:na]
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) [scala-library-2.10.3.jar:na]
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) [scala-library-2.10.3.jar:na]

配置:

datasource {
  driver-class = "com.mysql.jdbc.Driver"
  partition-count = 2
  min-connections-per-partition = 8
  max-connections-per-partition = 16
  connection-timeout = 5s
  connection-test-statement = "select 1"
  query-execute-time-for-log = 2s
  default-auto-commit = true
  acquire-increment = 1
  acquire-retry-attempts = 10
  acquire-retry-delay = 1s
  idle-max-age = 10minutes
  max-connection-age = 1h
}

有人可以告诉我 bonecp 或我的配置有什么问题吗?

4

1 回答 1

0

我发现最新的 BoneCP 版本有一个或多个与关闭连接有关的错误,我也遇到过类似的异常。尝试升级到 BoneCP 的最新快照。

于 2013-12-22T13:37:55.080 回答