[CDO] Potential bug in org.eclipse.net4j.internal.db.DBConnection [message #1277008] |
Tue, 25 March 2014 10:45 |
Ashish Shinde Messages: 21 Registered: August 2013 |
Junior Member |
|
|
Hi,
I am using a weekly build of CDO 4.3 with the db store and in a particular case a commit hangs for a while and then times out.
The sequence of events are
1. I query CDO on a particular eclass before adding any instance for it (valid use case for me and would happen at times). Since the DB store hasn't create a table for my eclass db store throws an exception
'Caused by: org.h2.jdbc.JdbcSQLException: Table "DEFECT" not found; SQL statement'
2. After this on the next add of an instance of the eclass the commit hangs for a while and then times out.
I have verified that in the following code, in org.eclipse.net4j.internal.db.DBConnection, the line with the throw statement exception is the culprit. My guess is database.endSchemaAccess() should be invoked in this case before throwing an exception.
public IDBPreparedStatement prepareStatement(final String sql, final int resultSetType, final int resultSetConcurrency,
final ReuseProbability reuseProbability)
{
database.beginSchemaAccess(false);
DBPreparedStatement preparedStatement;
synchronized (this)
{
preparedStatement = cache.remove(sql);
if (preparedStatement == null)
{
try
{
final PreparedStatement delegate = getDelegate().prepareStatement(sql, resultSetType, resultSetConcurrency);
preparedStatement = new DBPreparedStatement(this, sql, reuseProbability, delegate);
}
catch (final SQLException ex)
{
throw new DBException(ex);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
}
Adding the encSchemaAccess call solves my problem.
Also in the file org.eclipse.net4j.internal.db.DBDatabase in the function beginSchemaAccess should the schemaAccessQueue.wait() statement be called with a timeout? The block of code is synchronized with schemaAccessQueue, meaning no other thread would be able to enter the synchronized block in endSchemaAccess() and hence will never be able to notify of the lock release.
Thanks and regards,
- Ashish
|
|
|
|
Powered by
FUDForum. Page generated in 0.01830 seconds