Hello
We noticed that under heavy load (lack of memory) OJB returns closed Connections into the pool. This happens when the finalizer activates the finalize method of PersistenceBroker instances. At least MySQL Connections are already closed at this point (their finalize called as well?). Closed Connections cause a lot of trouble later on when borrowed back to use from the pool.
System Thread [Finalizer] (Suspended (breakpoint at line 61 in
ConnectionFactoryPooledImpl))
ConnectionFactoryPooledImpl.returnConnectionToPool(JdbcConnectionDescriptor,
Connection) line: 61
ConnectionFactoryPooledImpl(ConnectionFactoryAbstractImpl).releaseConnection(
JdbcConnectionDescriptor, Connection) line: 90
ConnectionManagerImpl.releaseConnection() line: 314
PersistenceBrokerImpl.close() line: 336
PersistenceBrokerImpl.finalize() line: 1946
Finalizer.invokeFinalizeMethod(Object) line: not available [native method]
Finalizer.runFinalizer() line: 83
Finalizer.access$100(Finalizer) line: 14
Finalizer$FinalizerThread.run() line: 160We added a simple check to an extended version of the ConnectionFactoryPooledImpl, which fixes the problem and could be applied to the original version, too.
-- Ilkka
public void returnConnectionToPool(JdbcConnectionDescriptor jcd,
Connection con) throws LookupException
{
try
{
if (!con.isClosed())
{
super.returnConnectionToPool(jcd, con);
}
}
catch (LookupException x)
{
throw x;
}
catch (Exception x)
{
throw new LookupException(x);
}
} public Connection getConnectionFromPool(JdbcConnectionDescriptor jcd)
throws LookupException
{
try
{
Connection con;
do
{
con = super.getConnectionFromPool(jcd);
} while (con.isClosed()); return con;
}
catch (LookupException x)
{
throw x;
}
catch (Exception x)
{
throw new LookupException(x);
}
}--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
