Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 336102

Summary: [DB] New DBException "A lock could not be obtained" on CDOUserTransaction.commit()
Product: [Modeling] EMF Reporter: Fabien Giquel <fabien.giquel>
Component: cdo.dbAssignee: Stefan Winkler <stefan>
Status: CLOSED WORKSFORME QA Contact: Eike Stepper <stepper>
Severity: normal    
Priority: P3 CC: stefan, stepper, vaisegid
Version: 4.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 336097    
Attachments:
Description Flags
stacktrace
none
A Junit Test for getting the issue none

Description Fabien Giquel CLA 2011-02-02 12:12:30 EST
Created attachment 188170 [details]
stacktrace

Our non-reg JUnit tests on MoDisco project encounters some regression with recent M5 cdo release (org.eclipse.emf.cdo_4.0.0.v20110201-0703) with message "A lock could not be obtained within the time requested".

The DBexception occurs (see attached stacktrace) when calling CDOUserTransaction.commit() service.

The root exception seems to be the java.sql.SQLException build from org.apache.derby.impl.services.locks.ConcurrentLockSet.

Does anyone has an idea ? Could it it be a wrong use of CDO API ?
Comment 1 Eike Stepper CLA 2011-02-03 10:34:23 EST
I doubt that is your wrong usage of CDO API, although I don't know your exact usage.

IMHO the stack trace indicates that something in Derby is wrong. We generally recommend to use H2 rather than Derby. Maybe a new Derby version would also help. You know we are bound to what Orbit offers here.

Is the exception predictably reproducible?

Maybe Stefan has more ideas...
Comment 2 Stefan Winkler CLA 2011-02-03 10:39:58 EST
Well, usually it's not Derby who's wrong. The problem with these exceptions is typically that Derby uses the most restrictive locking methods, in particular when creating or altering tables or columns (DDL).

Maybe it's an error in CDO (though, I don't know what could have changed between the milestones, as I have not been this active, lately :-( ). Anyways, I'd like to analyze the problem, but for this, I need a reproducible minimal test case or example (if possible, without references to external projects). Could you reduce the corresponding modisco test case in order to make it work with plain CDO?
Comment 3 Eike Stepper CLA 2011-02-03 10:45:56 EST
(In reply to comment #2)
> Well, usually it's not Derby who's wrong. The problem with these exceptions is
> typically that Derby uses the most restrictive locking methods, in particular
> when creating or altering tables or columns (DDL).

AbstractHorizontalClassMapping.createValueMappings() in the stack trace could indicate that.

> Maybe it's an error in CDO (though, I don't know what could have changed
> between the milestones, as I have not been this active, lately :-( ). 

We replaced the CDOIDMeta concept by external references. ExternalReferenceManager.lookupByID() is also in the stack trace.
Comment 4 Fabien Giquel CLA 2011-02-23 07:01:57 EST
Hi Stefan and Eike,

i come back here about this problem : the bug is reproductible. I wrote a minimal test case for easy issue production. Here is the process :

- use an Eclipse 3.7M5
- install required components from MoDisco nighlty update site http://download.eclipse.org/modeling/mdt/modisco/updates/nightly/ :
-- select all features from "MoDisco Infratructure" category
-- select the two features "MoDisco CDO Java Discoverer feature" & "MoDisco Java feature" from category "MoDisco Java Feature"

- import attached Junit test project in the workspace
- run the CDOJUnitTest class.

--> you should get the same error as described in attached stack trace".
The CDO implemented EPackage involved is in the plugin org.eclipse.gmt.modisco.java.cdo

Thanks in advance for your help.
Comment 5 Fabien Giquel CLA 2011-02-23 07:04:00 EST
Created attachment 189589 [details]
A Junit Test for getting the issue
Comment 6 Stefan Winkler CLA 2011-02-23 08:04:43 EST
Thank you, Fabien. I'll have a look..
Comment 7 Eike Stepper CLA 2011-02-23 10:32:14 EST
I know that Egidijus has been active in several bugzillas in this area...
Comment 8 Egidijus Vaisnora CLA 2011-02-23 12:48:52 EST
Fabien,

Can you test with 7178 revision or later? I think your problem should be solved. We got very similar problem during adding new EPackage'as into server.
Comment 9 Fabien Giquel CLA 2011-03-07 13:36:24 EST
Hi Egidijus,

thanks for the suggestion,

I did connect to the emf.cdo svn and checkout the last revision of org.Eclipse.net4j.db (7312 > 7178). Then i launch again the junit test, making sure the net4j.db project from workspace is encountered, and i got again the same error.

Are there other components to check out ? May be i should update cdo with one of the use one of the integration update site  ?
Comment 10 Egidijus Vaisnora CLA 2011-03-08 02:26:45 EST
> I did connect to the emf.cdo svn and checkout the last revision of
> org.Eclipse.net4j.db (7312 > 7178). Then i launch again the junit test, making
> sure the net4j.db project from workspace is encountered, and i got again the
> same error.

You should checkout whole CDO not only org.eclipse.net4j.db plugin. Target bug fixes for this problem are in 336932, 336688
Comment 11 Fabien Giquel CLA 2011-03-08 11:47:55 EST
Rather than checkout whole CDO, is there any receznt update site available ? I think about those ones : http://www.eclipse.org/cdo/downloads/updates.php
Comment 12 Eike Stepper CLA 2011-03-08 13:11:22 EST
The continous integration build job has a maximum delay of 3 hours: https://hudson.eclipse.org/hudson/job/emf-cdo-integration/lastSuccessfulBuild/artifact/result/site.p2
Comment 13 Fabien Giquel CLA 2011-03-24 14:24:46 EDT
The issue has disappeared since using the M6 CDO update site. I mark the bug as resolved.
Comment 14 Eike Stepper CLA 2011-04-12 09:42:38 EDT
Removing from release notes...