Pergunta

I'm running a Play 2.2.0 app, using Postgres 9.2-1002-jdbc4, and the Anorm 2.2.0 API. Every so often I have connection issues which look like:

2013-11-19 19:45:36,544 [ERROR][a.d.Dispatcher][play-akka.actor.default-dispatcher-17] This connection has been closed.org.postgresql.util.PSQLException: This connection has been closed.
    at org.postgresql.jdbc2.AbstractJdbc2Connection.checkClosed(AbstractJdbc2Connection.java:822) ~[org.postgresql.postgresql-9.2-1002-jdbc4.jar:na]
    at org.postgresql.jdbc2.AbstractJdbc2Connection.setAutoCommit(AbstractJdbc2Connection.java:769) ~[org.postgresql.postgresql-9.2-1002-jdbc4.jar:na]
    at com.jolbox.bonecp.ConnectionHandle.setAutoCommit(ConnectionHandle.java:1247) ~[com.jolbox.bonecp-0.8.0-rc1.jar:na]
    at com.jolbox.bonecp.ConnectionHandle.<init>(ConnectionHandle.java:251) ~[com.jolbox.bonecp-0.8.0-rc1.jar:na]
    at com.jolbox.bonecp.ConnectionHandle.recreateConnectionHandle(ConnectionHandle.java:273) ~[com.jolbox.bonecp-0.8.0-rc1.jar:na]
    at com.jolbox.bonecp.ConnectionHandle.close(ConnectionHandle.java:476) ~[com.jolbox.bonecp-0.8.0-rc1.jar:na]
    at play.api.db.AutoCleanConnection.close(DB.scala:485) ~[com.typesafe.play.play-jdbc_2.10-2.2.0.jar:2.2.0]
    at play.api.db.DBApi$class.withConnection(DB.scala:84) ~[com.typesafe.play.play-jdbc_2.10-2.2.0.jar:2.2.0]
    at play.api.db.BoneCPApi.withConnection(DB.scala:276) ~[com.typesafe.play.play-jdbc_2.10-2.2.0.jar:2.2.0]
    at play.api.db.DBApi$class.withTransaction(DB.scala:97) ~[com.typesafe.play.play-jdbc_2.10-2.2.0.jar:2.2.0]
    at play.api.db.BoneCPApi.withTransaction(DB.scala:276) ~[com.typesafe.play.play-jdbc_2.10-2.2.0.jar:2.2.0]
    at play.api.db.DB$$anonfun$withTransaction$4.apply(DB.scala:185) ~[com.typesafe.play.play-jdbc_2.10-2.2.0.jar:2.2.0]
    at play.api.db.DB$$anonfun$withTransaction$4.apply(DB.scala:185) ~[com.typesafe.play.play-jdbc_2.10-2.2.0.jar:2.2.0]
    at scala.Option.map(Option.scala:145) ~[org.scala-lang.scala-library-2.10.2.jar:na]
    at play.api.db.DB$.withTransaction(DB.scala:185) ~[com.typesafe.play.play-jdbc_2.10-2.2.0.jar:2.2.0]

There are no DB connectivity issues I know of; the DB runs on the same box. These connection issues occur intermittently around 2-3 times a day and recovers on its own.

I tried these ridiculously low connection test settings:

db.default.idleConnectionTestPeriod=10 seconds
db.default.idleMaxAge=30 seconds
db.default.maxConnectionAge=60 seconds

These connection settings seem to to reduce it though I'm wondering if something more fundamental is going on. Nothing appears in the postgres logs.

Foi útil?

Solução

There was a bug with regards to BoneCP (or a number of them, actually), which have been fixed in Play 2.2.3: https://github.com/playframework/playframework/pull/1898

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top