gpt4 book ai didi

playframework-2.0 - Play Framework 2,postgres "This connection has been closed"

转载 作者:行者123 更新时间:2023-12-04 08:52:31 25 4
gpt4 key购买 nike

我正在运行 Play 2.2.0 应用程序,使用 Postgres 9.2-1002-jdbc4 和 Anorm 2.2.0 API。每隔一段时间,我就会遇到如下连接问题:

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]

我知道没有数据库连接问题;数据库在同一个盒子上运行。这些连接问题每天大约会间歇性发生 2-3 次,并且会自行恢复。

我尝试了这些低得离谱的连接测试设置:
db.default.idleConnectionTestPeriod=10 seconds
db.default.idleMaxAge=30 seconds
db.default.maxConnectionAge=60 seconds

这些连接设置似乎减少了它,尽管我想知道是否发生了更基本的事情。 postgres 日志中没有任何内容。

最佳答案

有一个关于 BoneCP(或其中一些,实际上)的错误,已在 Play 2.2.3 中修复:https://github.com/playframework/playframework/pull/1898

关于playframework-2.0 - Play Framework 2,postgres "This connection has been closed",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20081134/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com