Hi there
I'm using a small rest server writen in Xitrum where I have a class to access my data.
I have the problem that after a number of requests equal to ConnectionPoolSettings.maxSize I get exceptions due to not being able to get connections from the pool. I tried increasing the timeout etc, closing the connection explicitly after each query but doesn't seem to work.
Does anybody have any idea that what I could be doing wrong?
I have a connection pool 'rg that I'm accessing with the following pattern:
def readOnly[A](name: scala.Any)(execution: scala.Function1[scalikejdbc.DBSession, A]): A = {
using(ConnectionPool.borrow(name)) { conn => DB(conn) readOnly execution
}
}
def getSomething... {
readOnly('rg) { implicit session =>
val res = sql"""SELECT....
}
But I always get:
org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting for idle object
at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:114) ~[commons-dbcp-1.4.jar:1.4]
at scalikejdbc.CommonsConnectionPool.borrow(CommonsConnectionPool.scala:58) ~[scalikejdbc-core_2.10-2.2.2.jar:2.2.2]
at scalikejdbc.ConnectionPool$.borrow(ConnectionPool.scala:225) ~[scalikejdbc-core_2.10-2.2.2.jar:2.2.2]
at com.here.routing.RGStorePostgreSQL.readOnly(RGStorePostgreSQL.scala:63) ~[classes/:na]
at com.here.routing.RGStorePostgreSQL.getSimilarity(RGStorePostgreSQL.scala:401) ~[classes/:na]
at com.here.vadis.server.action.Tiles.execute(Tiles.scala:18) [classes/:na]
at xitrum.action.Filter$$anonfun$1.apply$mcV$sp(Filter.scala:59) ~[xitrum_2.10-3.21.jar:3.21]
at xitrum.action.Filter$class.callExecuteWrappedInAroundFilters(Filter.scala:63) ~[xitrum_2.10-3.21.jar:3.21]
at com.here.vadis.server.action.Tiles.callExecuteWrappedInAroundFilters(Tiles.scala:12) [classes/:na]
at xitrum.Action$class.xitrum$Action$$callExecuteWrappedInAroundFiltersThenAfterFilters(Action.scala:183) ~[xitrum_2.10-3.21.jar:3.21]
at xitrum.Action$class.dispatchWithFailsafe(Action.scala:108) ~[xitrum_2.10-3.21.jar:3.21]
at com.here.vadis.server.action.Tiles.dispatchWithFailsafe(Tiles.scala:12) [classes/:na]
at xitrum.handler.inbound.Dispatcher$.dispatch(Dispatcher.scala:45) [xitrum_2.10-3.21.jar:3.21]
at xitrum.handler.inbound.Dispatcher.channelRead0(Dispatcher.scala:87) [xitrum_2.10-3.21.jar:3.21]
at xitrum.handler.inbound.Dispatcher.channelRead0(Dispatcher.scala:65) [xitrum_2.10-3.21.jar:3.21]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [netty-all-4.0.24.Final.jar:4.0.24.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [netty-all-4.0.24.Final.jar:4.0.24.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [netty-all-4.0.24.Final.jar:4.0.24.Final]
at xitrum.handler.inbound.MethodOverrider.channelRead0(MethodOverrider.scala:45) [xitrum_2.10-3.21.jar:3.21]
at xitrum.handler.inbound.MethodOverrider.channelRead0(MethodOverrider.scala:19) [xitrum_2.10-3.21.jar:3.21]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [netty-all-4.0.24.Final.jar:4.0.24.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [netty-all-4.0.24.Final.jar:4.0.24.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [netty-all-4.0.24.Final.jar:4.0.24.Final]
at xitrum.handler.inbound.UriParser.channelRead0(UriParser.scala:33) [xitrum_2.10-3.21.jar:3.21]
at xitrum.handler.inbound.UriParser.channelRead0(UriParser.scala:16) [xitrum_2.10-3.21.jar:3.21]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [netty-all-4.0.24.Final.jar:4.0.24.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [netty-all-4.0.24.Final.jar:4.0.24.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [netty-all-4.0.24.Final.jar:4.0.24.Final]
at xitrum.handler.inbound.WebJarsServer.channelRead0(WebJarsServer.scala:33) [xitrum_2.10-3.21.jar:3.21]
at xitrum.handler.inbound.WebJarsServer.channelRead0(WebJarsServer.scala:23) [xitrum_2.10-3.21.jar:3.21]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [netty-all-4.0.24.Final.jar:4.0.24.Final]
Does anybody have some idea that might help me?
Thanks a lot!
Pedro.