commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Thomas (JIRA)" <>
Subject [jira] Updated: (DBCP-156) [dbcp] Specifying the maximum lifetime of a connection
Date Wed, 20 May 2009 23:03:45 GMT


Mark Thomas updated DBCP-156:

    Fix Version/s:     (was: 1.3)

Commons-pool does not record the creation time of objects. Adding this would be non-trivial
as currently pool does not keep tabs on all the objects it creates. It tracks idle objects
but only keeps a count of active objects. Implementing this would require changing pool to
keep tabs on all objects.

I'm tempted to close this as won't fix. The underlying premise - that long lived database
connections are bad - doesn't seem right. I agree long lived idle connections are bad and
DBCP has ways to handle those. I don't see what is inherently wrong with long lived active

Pushing this to 2.0 as if this is implemented, I don't see it happening any earlier due to
the extent of the changes required to pool.

> [dbcp] Specifying the maximum lifetime of a connection
> ------------------------------------------------------
>                 Key: DBCP-156
>                 URL:
>             Project: Commons Dbcp
>          Issue Type: Improvement
>    Affects Versions: 1.1
>         Environment: Operating System: All
> Platform: All
>            Reporter: Juergen Hoeller
>            Priority: Minor
>             Fix For: 2.0
> It would be excellent if BasicDataSource had a "maxLifetime" property, for 
> specifying the maximum lifetime of a connection in the pool, no matter how long 
> it's been active or idle, and no matter whether it still seems to be alive. 
> Commons DBCP does not support this yet; it just offers various connection 
> validation means, which is not the same.
> This is particularly relevant for MySQL Connector/J 3.0.x which tries to apply 
> some weird automatic recovery when a MySQL connection has timed out, resulting 
> in all sorts of issues. The best way to deal with this is to set the maximum 
> lifetime of a connection to 4 hours or the like: If it's older, simply kill it, 
> even if it's still alive at that point of time.
> Note that Proxool ( does have such a property, 
> namely "maximum-connection-lifetime". Resin's connection pool has a similar 
> property named "max-pool-time" (
> config.xtp). I tend to prefer Commons DBCP, but the lack of such a property 
> forces me to look for alternative pools.
> Juergen

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message