commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mork0075 <>
Subject DriverManager.getConnection hangs if connectionLimit is reached
Date Fri, 03 Apr 2009 16:53:09 GMT

i'am trying to debug a certain problem in an application using Apache
Commons DBCP. The app is a webapp with jetty as integrated webserver.
Jetty's worker threads handle the request, obtaining a database
connection to a MySQL database using
DriverManager.getConnection("jdbc:apache:commons:dbcp:example") (no
Hibernate, Ibatis around, a self written OR Mapper instead)

This works fine until a certain scenario: if the number of concurrent
requests reaches the number of maximum connections in the connection pool.

If the connection pool can store 30 connections and you fire 29
concurrent requests to the webapp, everything is fine and you can go
with another request. If you fire 30 concurrent (this means #connections
= #concurrentRequests) it is not possible to go on in the application
getting another connection. Debugging this shows that
DriverManager.getConnection("jdbc:apache:commons:dbcp:example") hangs
for another request (after the 30 concurrent ones).

I can reproduce this with any connection pool size. Limiting the pool to
5 works fine up to 4 concurrent requests, until 5 or more concurrent
requests occur.

Have you got an idea how this can happen? (there're no exceptions and
concurrent connections below the threshold are all 'closed' (returned to
the pool), I've checked this with connectionPool.getNumActive()).

Thanks in advance

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message