You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2003/07/02 14:03:33 UTC
DO NOT REPLY [Bug 21273] New: -
Memory-leak like behaviour in DBCP due to warnings chained to connections in the pool
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21273>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21273
Memory-leak like behaviour in DBCP due to warnings chained to connections in the pool
Summary: Memory-leak like behaviour in DBCP due to warnings
chained to connections in the pool
Product: Commons
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Severity: Normal
Priority: Other
Component: Dbcp
AssignedTo: commons-dev@jakarta.apache.org
ReportedBy: joachim.schuler@epecon.de
We have recently migrated a web application from using poolman to DBCP. The
db driver used for this application is the current version of jconnect
(Sybsase).
During some long-term tests, we observed a memory-leak like behaviour, caused
by a growing number of objects on the heap which could not be garbage
collected. After some investigation we found out that the memory is consumed
by SQLWarnings, chained to connections in the pool. The SQLWarnings are
generated when calling setReadOnly() on the underlying Connection (which is
done regularly when taking an object from the pool). These warnings never get
cleared.
We feel the application should not have to worry about that, but instead the
pool should provide a Connection without any "old" SQLWarnings attached to it.
We have therefore introduced a patch into DBCP. A modified version of
PoolableConnectionFactory.passivateObject(Object obj) that is clearing the old
SQLWarnings when returning a connection to the pool might look like this:
public void passivateObject(Object obj) throws Exception {
if(obj instanceof Connection) {
Connection conn = (Connection)obj;
if(!conn.getAutoCommit()) {
conn.rollback();
}
try {
conn.clearWarnings();
} catch(Exception e) {}
}
if(obj instanceof DelegatingConnection) {
((DelegatingConnection)obj).passivate();
}
}
We would be glad to see this or a similar solution incorporated into the
DBCP source tree.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org