c3p0-users

I am using log4jdbc so that I can see when c3p0 opens and closes connections
and I see the maxIdleTime setting working, however with the
acquireRetryAttempts, I expected calling a getConnection would try 30 times
and for a max pool of 20 result in 20 failures since my db was restarted and
then 1 success when it gets the new connection cleaning up all the
connections when one customer interacts with it. Instead, I am seeing 20
customers being affected when no one should be affected since the db is back
up. In fact, with one customer, I have to login X times where X is the
current number of connections and then the next login works since the
connections are cleaned up. Any ideas? my properties cut and pasted from
the logs....
[ acquireIncrement -> 1, acquireRetryAttempts -> 30, acquireRetryDelay ->
1000, autoCommitOnClose -> false, automaticTestTable -> null,
breakAfterAcquireFailure -> false, checkoutTimeout -> 0,
connectionTesterClassName -> com.mchange.v2.c3p0.imp
Also, I don't see a single retry...I see it try to run sql on the connection
and then close that connection due to failure and open a new connection(so
while the connection is cleaned up, my login fails and I have to relogin
which happens to grab another stale connection and fail again).
thanks,
Dean

Dean,
acquireRetryAttempts affects how many times c3p0 will attempt to get a
Connection from the database. It has no effect on Connections that
clients have already checked out from the pool. It determines how many
times the pool will seek to fetch a _single_ connection, if it
experiences errors. acquireRetryAttempts has no effect at all on how
many Connections the pool acquires. minPoolSize, maxPoolSize, load,
and the maxIdleTime properties determine that.
It sounds like each of your clients hold an open Connection, which is
probably not the best architecture for an application working against
a Connection pool. It's better of clients acquire Connections on
demand and then close() them promptly.
If clients hold open Connections which they acquire at login and your
database goes down, then all of those Connections will be stale and
there is nothing c3p0 can do about it. They will each have to
reacquire Connections.
If each client holds a reference to a Connection pool, and an
reacquires Connections as needed, you will get the behavior that you
want, that is automatic healing of the application following a shut
down/restart of the database.
smiles,
Steve
On Apr 27, 2010, at 12:33 AM, Dean Hiller wrote:
> I am using log4jdbc so that I can see when c3p0 opens and closes
> connections and I see the maxIdleTime setting working, however with
> the acquireRetryAttempts, I expected calling a getConnection would
> try 30 times and for a max pool of 20 result in 20 failures since my
> db was restarted and then 1 success when it gets the new connection
> cleaning up all the connections when one customer interacts with
> it. Instead, I am seeing 20 customers being affected when no one
> should be affected since the db is back up. In fact, with one
> customer, I have to login X times where X is the current number of
> connections and then the next login works since the connections are
> cleaned up. Any ideas? my properties cut and pasted from the
> logs....
>
> [ acquireIncrement -> 1, acquireRetryAttempts -> 30,
> acquireRetryDelay -> 1000, autoCommitOnClose -> false,
> automaticTestTable -> null, breakAfterAcquireFailure -> false,
> checkoutTimeout -> 0, connectionTesterClassName ->
> com.mchange.v2.c3p0.imp
>
> Also, I don't see a single retry...I see it try to run sql on the
> connection and then close that connection due to failure and open a
> new connection(so while the connection is cleaned up, my login fails
> and I have to relogin which happens to grab another stale connection
> and fail again).
>
> thanks,
> Dean
> ------------------------------------------------------------------------------
>
> _______________________________________________
> c3p0-users mailing list
> c3p0-users@...
> https://lists.sourceforge.net/lists/listinfo/c3p0-users