Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 336708 - [DB] Derby test failing
Summary: [DB] Derby test failing
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.core (show other bugs)
Version: 4.0   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Egidijus Vaisnora CLA
QA Contact: Eike Stepper CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-09 08:14 EST by Egidijus Vaisnora CLA
Modified: 2011-06-23 03:40 EDT (History)
1 user (show)

See Also:
stepper: review+


Attachments
Patch v1 (1.70 KB, patch)
2011-02-10 04:44 EST, Egidijus Vaisnora CLA
no flags Details | Diff
Patch v2 (2.71 KB, patch)
2011-02-10 09:00 EST, Eike Stepper CLA
no flags Details | Diff
Patch v3 - ready to be committed (3.58 KB, patch)
2011-02-10 09:31 EST, Eike Stepper CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Egidijus Vaisnora CLA 2011-02-09 08:14:41 EST
After last updates CDO tests fails to run on CDO configuration with derby: "A lock could not be obtained within the time requested"
Comment 1 Egidijus Vaisnora CLA 2011-02-09 08:17:09 EST
revision 7030 from trunk
Comment 2 Stefan Winkler CLA 2011-02-09 10:00:26 EST
I guess this is related to Eikes change of the activation process in Bug 336642.
Since Derby is one of the few databases which perform restrictive locking when creating or altering tables, this can lead to deadlocks resulting in the mentioned exception.
Comment 3 Egidijus Vaisnora CLA 2011-02-10 04:44:31 EST
Created attachment 188663 [details]
Patch v1

Exception was thrown on closing DB connection - "transaction in use". While exception was consumed without showing it, it was hard to point problem easily. Problem seems to be that connection was not commited (autocommit == false)
Comment 4 Egidijus Vaisnora CLA 2011-02-10 08:30:24 EST
In patch I have enabled logger in order to avoid in future simile bugs, but now starting server second time I got exception. Looking at the code - result set are properly closed... Do I need to make commit or rollback, just to finish transaction?

ava.sql.SQLException: Cannot close a connection while a transaction is still active.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedConnection.checkForTransactionInProgress(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedConnection.close(Unknown Source)
	at org.eclipse.net4j.db.DBUtil.close(DBUtil.java:183)
	at org.eclipse.emf.cdo.server.internal.db.DBStore.getPropertyValues(DBStore.java:295)
	at org.eclipse.emf.cdo.server.internal.db.DBStore.isFirstStart(DBStore.java:569)
	at org.eclipse.emf.cdo.server.internal.db.DBStore.doActivate(DBStore.java:523)
	at org.eclipse.net4j.util.lifecycle.Lifecycle.activate(Lifecycle.java:72)
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(LifecycleUtil.java:99)
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(LifecycleUtil.java:89)
	at org.eclipse.emf.cdo.internal.server.Repository.doActivate(Repository.java:1548)
	at org.eclipse.net4j.util.lifecycle.Lifecycle.activate(Lifecycle.java:72)
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(LifecycleUtil.java:99)
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(LifecycleUtil.java:89)
	at org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOServerUtil.java:201)
	at org.eclipse.emf.cdo.internal.server.RepositoryConfigurator.configure(RepositoryConfigurator.java:96)
	at org.eclipse.emf.cdo.internal.server.bundle.CDOServerApplication.doStart(CDOServerApplication.java:61)
	at org.eclipse.net4j.util.om.OSGiApplication.start(OSGiApplication.java:61)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.equinox.internal.app.AnyThreadAppLauncher.run(AnyThreadAppLauncher.java:26)
	at java.lang.Thread.run(Thread.java:680)
Comment 5 Eike Stepper CLA 2011-02-10 09:00:02 EST
Created attachment 188683 [details]
Patch v2

I cannot believe that we need a writer rather than a reader just to make Derby happy. I've not yet run the Derby suite, but isn't the closing of the resultSet already enough?
Comment 6 Eike Stepper CLA 2011-02-10 09:02:27 EST
Maybe you need to szudy the code of org.apache.derby.impl.jdbc.EmbedConnection.checkForTransactionInProgress() ?
Comment 7 Eike Stepper CLA 2011-02-10 09:02:51 EST
(In reply to comment #6)
> Maybe you need to szudy the code of
> org.apache.derby.impl.jdbc.EmbedConnection.checkForTransactionInProgress() ?

study ;-)
Comment 8 Egidijus Vaisnora CLA 2011-02-10 09:28:18 EST
> I cannot believe that we need a writer rather than a reader just to make Derby
> happy. I've not yet run the Derby suite, but isn't the closing of the resultSet
> already enough?

You are creating table "cdo_external_refs" running server for the first time, hence there is a writer. While we can create a table in this connection, then we need to commit transaction. Am I missing here something?
Comment 9 Eike Stepper CLA 2011-02-10 09:30:44 EST
Sorry, I just realized this, now that I executed the Derby tests. Making new patch...
Comment 10 Eike Stepper CLA 2011-02-10 09:31:21 EST
Created attachment 188685 [details]
Patch v3 - ready to be committed
Comment 11 Egidijus Vaisnora CLA 2011-02-10 09:52:14 EST
Committed to trunk, revision 7052
Comment 12 Eike Stepper CLA 2011-06-23 03:40:55 EDT
Available in R20110608-1407