Share

c3p0:JDBC DataSources/Resource Pools

Tracker: Bugs

5 memory leak in long-running txn - ID: 1956315
Last Update: Comment added ( soronthar )

I believe there is a memory leak in long-running transactions when using
the pool. I have lost my screenshot but it appears some listener map is
holding references to c3p0 proxy result sets. I can't remember if this is
on the connection or prepared statement.

While this may be an edge case, I think it is a valid bug. Some
transactions can last over an hour though there are arguably better ways to
design the applications. We are using c3p0 via hibernate and spring. I
assume these libraries are using the API properly and cleaning what they
need to up.

We don't have this issue with other db pools. Not a criticism, just
pointing out a difference in implementation.


Nobody/Anonymous ( nobody ) - 2008-05-02 16:48

5

Open

None

Nobody/Anonymous

None

None

Public


Comments ( 4 )




Date: 2009-10-06 20:29
Sender: soronthar

I found out that when there is a memory leak during a long-lived tx using
c3p0, it is most likely created by not closing your resultsets and
statements appropriately.
This happens because there are several places where the pool keeps
references to resultsets, statements and connections (to be able to clean
the house at the end), and these references are freed only when you close
each resource in the proper way.


Date: 2009-10-01 05:56
Sender: nobody

I found out that NewProxyResultSet instance created in
NewProxyPreparedStatement.getGeneratedKeys() method may not be closed.
Hence, it was not detached from eventlistenersupport properly.


Date: 2009-09-30 21:44
Sender: nobody

We are seeing the same situation.
com.mchange.v2.c3p0.util.ConnectionEventSupport is holding references to
c3p0 proxy result sets.


Date: 2008-05-02 16:59
Sender: swaldmanProject Admin


...a memory leak is a valid criticism, and c3p0 strives not to have 'em,
regardless of any way you beat up the JDBC api without violating
standard-documented constraints. you c'n keep a transaction open your whole
life, if your DB is cool with that.

it's be good if you could reproduce that heap screenshot, though...
offhand, i can't think of why proxy result sets would be held referenced in
a long txn. except.

if you are keeping txns open very long, you should definitely be
close()ing your ResultSets promptly... c3p0 certainly won't clean 'em up
for you while the txn is still open! are you?

anyway, if you tell me who's pointing to what, that'd be helpful.

smiles,
Steve


Log in to comment.




Attached File

No Files Currently Attached

Change

No changes have been made to this artifact.