2012-08-30 20 views
5

私はhelokuのlocalhostからDevデータベースへの接続を設定しています(Errors in evolutions on Herokuで説明されています)、Evolutionsを適用しようとした後で次のエラーを受け取ります。時間:Heroku POSTGRESQL - 「ロールの接続が多すぎます」エラー

SQLException: Unable to open a test connection to the given database. JDBC url = [URL], username = null. Terminating connection pool. 
Original Exception: org.postgresql.util.PSQLException: FATAL: too many connections for role "ntnkypawxazhwo" 
    at org.postgresql.core.v3.ConnectionFactoryImpl.readStartupMessages(ConnectionFactoryImpl.java:469) 
    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:110) 
    at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:64) 
    at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:123) 
    at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:28) 
    at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:20) 
    at org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:30) 
    at org.postgresql.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:22) 
    at org.postgresql.Driver.makeConnection(Driver.java:391) 
    at org.postgresql.Driver.connect(Driver.java:265) 
    at play.utils.ProxyDriver.connect(ProxyDriver.scala:9) 
    at java.sql.DriverManager.getConnection(Unknown Source) 
    at java.sql.DriverManager.getConnection(Unknown Source) 
    at com.jolbox.bonecp.BoneCP.obtainRawInternalConnection(BoneCP.java:256) 
    at com.jolbox.bonecp.BoneCP.<init>(BoneCP.java:305) 
    at com.jolbox.bonecp.BoneCPDataSource.maybeInit(BoneCPDataSource.java:150) 
    at com.jolbox.bonecp.BoneCPDataSource.getConnection(BoneCPDataSource.java:112) 
    at play.api.db.DBApi$class.getConnection(DB.scala:64) 
    at play.api.db.BoneCPApi.getConnection(DB.scala:273) 
    at play.api.db.evolutions.Evolutions$.databaseEvolutions(Evolutions.scala:306) 
    at play.api.db.evolutions.Evolutions$.evolutionScript(Evolutions.scala:284) 
    at play.api.db.evolutions.OfflineEvolutions$.applyScript(Evolutions.scala:452) 
    at play.core.ReloadableApplication.handleWebCommand(ApplicationProvider.scala:175) 
    at play.core.server.Server$$anonfun$getHandlerFor$1.apply(Server.scala:86) 
    at play.core.server.Server$$anonfun$getHandlerFor$1.apply(Server.scala:86) 
    at scala.util.control.Exception$Catch$$anonfun$either$1.apply(Exception.scala:110) 
    at scala.util.control.Exception$Catch$$anonfun$either$1.apply(Exception.scala:110) 
    at scala.util.control.Exception$Catch.apply(Exception.scala:88) 
    at scala.util.control.Exception$Catch.either(Exception.scala:110) 
    at play.core.server.Server$class.getHandlerFor(Server.scala:86) 
    at play.core.server.NettyServer.getHandlerFor(NettyServer.scala:38) 
    at play.core.server.netty.PlayDefaultUpstreamHandler.messageReceived(PlayDefaultUpstreamHandler.scala:226) 
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75) 
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:558) 
    at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:777) 
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296) 
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.unfoldAndFireMessageReceived(ReplayingDecoder.java:522) 
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:501) 
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:438) 
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75) 
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:558) 
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:553) 
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268) 
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255) 
    at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:343) 
    at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:274) 
    at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:194) 
    at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:102) 
    at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 
    at java.lang.Thread.run(Unknown Source) 

デベロッパーデータベースには固定接続数(20個程度)があります。私は自分の接続を適切に閉じていることを確認するにはどうすればよいですか?

+0

この質問の解決方法を試してください:http://stackoverflow.com/questions/15480506/heroku-play-bonecp-connection-issues/15500442#15500442 – MaFo

答えて

6

PlayのJDBC settingsを使用すると、接続数を減らすことができます。パーティションを1つだけ設定して開始してください:

db.default.partitionCount=1 

そして、パーティションごとの接続時間と接続数を制限するように調整してください。