Heroku / Play / BoneCp连接问题 [英] Heroku/Play/BoneCp connection issues
本文介绍了Heroku / Play / BoneCp连接问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个应用程序在heroku上使用游戏。它在最长时间内工作正常,但是最近我开始得到这个结果:
原因:java.sql.SQLException:超时等待免费可用连接。
$ p $由
at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:169)〜[hibernate-core-4.1.9.Final.jar:4.1.9.Final]
at com.jolbox.bonecp.BoneCP.getConnection(BoneCP.java:503)〜[bonecp-0.7.1.RELEASE.jar:0.7.1.RELEASE]
org.postgresql.util.PSQLException引发的
致命:FATAL :连接角色太多ejmatdbwywaugk
现在,这显然是一个连接泄漏,除了我使用JPA.em()。 Play例子从未关闭像这样获得的实体管理器。我尝试关闭它,但随后应用程序爆炸说实体管理器已关闭。
有什么想法?
解决方案使用BoneCP 0.8.0-rc1并使用此配置:
db。 default.idleMaxAge = 10分钟
db.default.idleConnectionTestPeriod = 30秒
db.default.connectionTimeout = 20秒
db.default.connectionTestStatement =SELECT 1
db。 default.maxConnectionAge = 30分钟
I have an app on heroku that uses play. It was working fine for the longest time, but somewhat recently I started getting this:
Caused by: java.sql.SQLException: Timed out waiting for a free available connection. at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:169) ~[hibernate-core-4.1.9.Final.jar:4.1.9.Final] at com.jolbox.bonecp.BoneCP.getConnection(BoneCP.java:503) ~[bonecp-0.7.1.RELEASE.jar:0.7.1.RELEASE]
which is caused by
org.postgresql.util.PSQLException: FATAL: too many connections for role "ejmatdbwywaugk"
Now this is pretty obviously a connection leak, except that I'm using JPA.em(). The Play examples never close an entity manager obtained like this. I tried closing it, but then the app blows up saying the entity manager is closed.
Any ideas?
解决方案Try with BoneCP 0.8.0-rc1 and use this configuration:
db.default.idleMaxAge=10 minutes db.default.idleConnectionTestPeriod=30 seconds db.default.connectionTimeout=20 second db.default.connectionTestStatement="SELECT 1" db.default.maxConnectionAge=30 minutes
这篇关于Heroku / Play / BoneCp连接问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文