openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kellermann, Michael" <>
Subject IBM JRE garbage collection closes connections which are still in use
Date Thu, 11 Sep 2008 12:07:31 GMT
Hi everybody,
the following problem occured in openjpa 0.9.7. However, the affected
code in openjpa 1.1.0 looks identical.
error scenario:
Some bundles are running in an osgi container. The JRE is an IBM JRE (
we did not see the problem with a sun jre).
We are using openjpa 0.9.7 and the dbcp pool.
The gc runs periodically and it calls the finalize() method of
Occasionally, after gc has run, we get a ReportingSQLException saying
'connection not open'.
our fix:
We removed the finalize() method in
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.ClientConnection. This
finalizer calls close() in its super which is a DelegatingConnection.
The DelegatingConnection.close() closes the wrapped connection. It seems
that this connection may be in use by another thread.
After removing the finalizer in ClientConnection, we ran our application
for several hours and the ReportingSQLException did no longer occur. 
Should the finalize() method not check whether the connection is managed
by a pool? In my understanding it is a task of the pool to really close
a connection, the ClientConnection.close() should only return the
connection into the pool.
Will this problem be fixed in a future openjpa release?
Michael Kellermann

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message