[ERROR] [05/20/2012 18:21:21.172] [application-akka.actor.default-dispatcher-5] [akka://application/user/$a] Timed out waiting for a free available connection.
java.sql.SQLException: Timed out waiting for a free available connection.
at com.jolbox.bonecp.BoneCP.getConnection(BoneCP.java:503)
at com.jolbox.bonecp.BoneCPDataSource.getConnection(BoneCPDataSource.java:114)
at play.api.db.DBApi$class.getConnection(DB.scala:62)
at play.api.db.BoneCPApi.getConnection(DB.scala:264)
at play.api.db.DBApi$class.withConnection(DB.scala:75)
at play.api.db.BoneCPApi.withConnection(DB.scala:264)
at play.api.db.DB$$anonfun$withConnection$3.apply(DB.scala:156)
at play.api.db.DB$$anonfun$withConnection$3.apply(DB.scala:156)
at scala.Option.map(Option.scala:133)
at play.api.db.DB$.withConnection(DB.scala:156)
at models.User$.expireCredits(User.scala:170)
at actors.UserHelper$$anonfun$receive$1.apply(UserHelper.scala:52)
at actors.UserHelper$$anonfun$receive$1.apply(UserHelper.scala:44)
at akka.actor.Actor$class.apply(Actor.scala:311)
at actors.UserHelper.apply(UserHelper.scala:43)
at akka.actor.ActorCell.invoke(ActorCell.scala:619)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:196)
at akka.dispatch.Mailbox.run(Mailbox.scala:178)
at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:505)
at akka.jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:259)
at akka.jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:974)
at akka.jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1478)
at akka.jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104)
mysql> show variables like 'max_connections';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 991 |
+-----------------+-------+
WARN - BoneCP detected an unclosed connection and will now attempt to close it for you. You should be closing this connection in your application - enable connectionWatch for additional debugging assistance.
// Pool configuration
datasource.setPartitionCount(conf.getInt("partitionCount").getOrElse(1))
datasource.setMaxConnectionsPerPartition(conf.getInt("maxConnectionsPerPartition").getOrElse(30))
datasource.setMinConnectionsPerPartition(conf.getInt("minConnectionsPerPartition").getOrElse(5))
datasource.setAcquireIncrement(conf.getInt("acquireIncrement").getOrElse(1))
datasource.setAcquireRetryAttempts(conf.getInt("acquireRetryAttempts").getOrElse(10))
datasource.setAcquireRetryDelayInMs(conf.getMilliseconds("acquireRetryDelay").getOrElse(1000))
datasource.setConnectionTimeoutInMs(conf.getMilliseconds("connectionTimeout").getOrElse(1000))
datasource.setIdleMaxAge(conf.getMilliseconds("idleMaxAge").getOrElse(1000 * 60 * 10), java.util.concurrent.TimeUnit.MILLISECONDS)
datasource.setMaxConnectionAge(conf.getMilliseconds("maxConnectionAge").getOrElse(1000 * 60 * 60), java.util.concurrent.TimeUnit.MILLISECONDS)
datasource.setDisableJMX(conf.getBoolean("disableJMX").getOrElse(true))
datasource.setIdleConnectionTestPeriod(conf.getMilliseconds("idleConnectionTestPeriod").getOrElse(1000 * 60), java.util.concurrent.TimeUnit.MILLISECONDS)
def keepDbConnectionFresh = Action {
DB.withConnection(c => 1)
Ok("ok")
}
Akka.system.scheduler.schedule(2.minutes, 2.minute)({DB.withConnection(c => 1)})
result = connectionPartition.getFreeConnections().poll(this.connectionTimeoutInMs, TimeUnit.MILLISECONDS);
if (result == null){
if (this.nullOnConnectionTimeout){
return null;
}
// 08001 = The application requester is unable to establish the connection.
throw new SQLException("Timed out waiting for a free available connection.", "08001");
}
public void setConnectionTestStatement(String connectionTestStatement)
Default: Use metadata request
connectionTestStatement - to set.getFreeConnections(). The exception that we are getting is thrown by getFreeConnections(). My guess is that after the connections have been idle for sometime, they get closed. So getFreeConnection tries to open a new one and if takes longer than the set timeout, it throws an exception. The default timeout set by Play was 1 sec, which may or may not be enough depending on network latency, etc. As long as an open connection is available in the pool, getFreeConnections seems to work fine. --You received this message because you are subscribed to the Google Groups "play-framework" group.To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
The same issue on play-2.1.3. I've updated BoneCP. Didn't help. It'huge problem!!!
--
You received this message because you are subscribed to a topic in the Google Groups "play-framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/play-framework/n5FW16QHu_c/unsubscribe.
To unsubscribe from this group and all its topics, send an email to play-framewor...@googlegroups.com.