Bug 302838 - [DB] Rollback in DBStore: java.lang.IllegalArgumentException: id instanceof CDOIDTemp
Summary: [DB] Rollback in DBStore: java.lang.IllegalArgumentException: id instanceof C...
Status: NEW
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.db (show other bugs)
Version: 4.13   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Eike Stepper CLA
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2010-02-15 03:42 EST by Sabri Skhiri CLA
Modified: 2020-12-11 10:42 EST (History)
3 users (show)

See Also:


Attachments
The project I used to reproduce the bug (1.30 MB, application/octet-stream)
2010-02-25 10:56 EST, Sabri Skhiri CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sabri Skhiri CLA 2010-02-15 03:42:31 EST
Build-ID:3.0.0.v200910010403 and main trunk on CVS as well

Bug related to the topic http://www.eclipse.org/forums/index.php?t=msg&goto=514394&#msg_514394

I am playing with the material given by Eike at Eclipse summit during the Advanced Programming Techniques with EMF and CDO, but I have got the same problem with the last CVS version:
I have a problem when creating a simple Root Eobject within a transaction:
CDOSession session = openSession();
session.getPackageRegistry().putEPackage(InventoryPackage.eINSTANCE);
// open the transaction
CDOTransaction transaction = session.openTransaction();

// create the resource
CDOResource resource = transaction.getResource("/edine/resto2.inventory");
// Work with resource
Restaurant restaurant = InventoryFactory.eINSTANCE.createRestaurant();
resource.getContents().add(restaurant);

// Commit the transaction
transaction.commit();

session.close();

Same problem when committing from the CDO session UI.

The exception is:
Exception in thread "main" org.eclipse.net4j.util.transaction.TransactionException: Rollback in DBStore: java.lang.IllegalArgumentException: id instanceof CDOIDTemp
at org.eclipse.emf.cdo.common.id.CDOIDUtil.getLong(CDOIDUtil.ja va:87)
at org.eclipse.emf.cdo.server.internal.db.MetaDataManager.getMe taID(MetaDataManager.java:72)
at org.eclipse.emf.cdo.server.internal.db.mapping.AbstractMappi ngStrategy.getTableName(AbstractMappingStrategy.java:256)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ab stractHorizontalClassMapping.initTable(AbstractHorizontalCla ssMapping.java:82)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ab stractHorizontalClassMapping. <init>(AbstractHorizontalClassMapping.java:76)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ho rizontalAuditClassMapping. <init>(HorizontalAuditClassMapping.java:64)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ho rizontalAuditMappingStrategy.doCreateClassMapping(Horizontal AuditMappingStrategy.java:29)
at org.eclipse.emf.cdo.server.internal.db.mapping.AbstractMappi ngStrategy.createClassMapping(AbstractMappingStrategy.java:3 84)
at org.eclipse.emf.cdo.server.internal.db.mapping.AbstractMappi ngStrategy.getClassMapping(AbstractMappingStrategy.java:411)
at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.write Revision(DBStoreAccessor.java:359)
at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.write Revisions(DBStoreAccessor.java:342)
at org.eclipse.emf.cdo.spi.server.StoreAccessor.write(StoreAcce ssor.java:145)
at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.acces s$4(DBStoreAccessor.java:1)
at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor$1.run Loop(DBStoreAccessor.java:80)
at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor$1.run Loop(DBStoreAccessor.java:1)
at org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(Pr ogressDistributor.java:96)
at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.write (DBStoreAccessor.java:299)
at org.eclipse.emf.cdo.internal.server.TransactionCommitContext Impl.write(TransactionCommitContextImpl.java:273)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTra nsactionIndication$1.runLoop(CommitTransactionIndication.jav a:72)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTra nsactionIndication$1.runLoop(CommitTransactionIndication.jav a:1)
at org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(Pr ogressDistributor.java:96)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTra nsactionIndication.indicatingCommit(CommitTransactionIndicat ion.java:280)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTra nsactionIndication.indicating(CommitTransactionIndication.ja va:173)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTra nsactionIndication.indicating(CommitTransactionIndication.ja va:139)
at org.eclipse.net4j.signal.IndicationWithMonitoring.indicating (IndicationWithMonitoring.java:84)
at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedIn put(IndicationWithResponse.java:90)
at org.eclipse.net4j.signal.Signal.doInput(Signal.java:312)
at org.eclipse.net4j.signal.IndicationWithResponse.execute(Indi cationWithResponse.java:63)
at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(In dicationWithMonitoring.java:63)
at org.eclipse.net4j.signal.Signal.runSync(Signal.java:239)
at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Threa dPoolExecutor.java:650)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo lExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)

at org.eclipse.emf.internal.cdo.transaction.CDOSingleTransactio nStrategyImpl.commit(CDOSingleTransactionStrategyImpl.java:6 3)
at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl. commit(CDOTransactionImpl.java:621)
at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl. commit(CDOTransactionImpl.java:635)
at org.gastro.exercises.Exercice11b.main(Exercice11b.java:90)
Comment 1 Stefan Winkler CLA 2010-02-16 12:39:25 EST
Hi Sabri,

thanks for your Bug report. So far I am not able to reproduce it, though.

I have put your code into a test class:

public class Bugzilla_302838_Test extends AbstractCDOTest
{
  public void testRestaurant()
  {
    {
      CDOSession session = openSession();

      // open the transaction
      CDOTransaction transaction = session.openTransaction();

      // create the resource
      transaction.createResource("/edine/resto2.inventory");

      transaction.commit();
      session.close();
    }

    CDOSession session = openSession();
    session.getPackageRegistry().putEPackage(InventoryPackage.eINSTANCE);
    // open the transaction
    CDOTransaction transaction = session.openTransaction();

    // create the resource
    CDOResource resource = transaction.getResource("/edine/resto2.inventory");
    // Work with resource
    Restaurant restaurant = InventoryFactory.eINSTANCE.createRestaurant();
    resource.getContents().add(restaurant);

    // Commit the transaction
    transaction.commit();

    session.close();
  }
}

I had to introduce the block above, because the resource obviously would not exist on an empty database. I tried the code with several databases and configurations, but could not provoke the exception you report.

Can you please give some more information about you configuration? Which DB do you use? What is your server configuration?
Also, can you tell me how your resource is created in the code you gave?
Comment 2 Stefan Winkler CLA 2010-02-16 12:43:02 EST
As a side-note: 
Eike, the Exception implies that the following call

CDOID cdoid = getPackageRegistry().getMetaInstanceMapper().lookupMetaInstanceID((InternalEObject)modelElement);

returns a CDOIDTemp for a modelElement instanceof EStructuralFeature. How can this happen?
Comment 3 Sabri Skhiri CLA 2010-02-17 03:16:11 EST
Hi Stefan,

Thanx for your reactivity. 
Actually even I create the resource before, and that this creation successes, if I try to commit something on this resource it fails. So, I do no think that getOrCreateResource() or createResource() are involved.

Note: the package was registered as Dynamic in CDO, not as native. Does it change anything ?

Configuration info:
* DB: h2
* CDO 3.0.0.v200910010403 and Last from repository
* Exception on Linux Ubuntu and Win XP

Do you need something else ?
Comment 4 Caspar D. CLA 2010-02-22 21:58:20 EST
Stefan asked for someone to comment whether bug 303466 might
have any relation to this.

At first sight, I think not, because the code snippets I see here 
use the generated InventoryPackage.

But then I'm a bit confused by Sabri's Feb 17 comment that "the 
package was registered as Dynamic in CDO, not as native"...

I'm guessing we either do not agree on the meaning of the term 
"dynamic", which AFAIC is defined by EMFUtil.isDynamicPackage(Object); 
or perhaps the code which actually produced the stacktrace is different 
from what's given in the initial bug report?

Please clarify..
Comment 5 Eike Stepper CLA 2010-02-23 02:37:18 EST
(In reply to comment #4)
> But then I'm a bit confused by Sabri's Feb 17 comment that "the 
> package was registered as Dynamic in CDO, not as native"...

Just a minor correction: dynamic models are in fact native. At runtime they are using DynamicCDOObjects which derive from CDOObjectImpl.
Comment 6 Caspar D. CLA 2010-02-23 06:19:57 EST
(In reply to comment #5)
> Just a minor correction: dynamic models are in fact native. At runtime they are
> using DynamicCDOObjects which derive from CDOObjectImpl.

Noted, which makes native-vs-non-native irrelevant for this bug.

Therefore, Sabri, please clarify if you really encountered this problem 
using a *non-generated* model. The code snippets in your original report
suggest that you were using the *generated* InventoryPackage.
Comment 7 Sabri Skhiri CLA 2010-02-23 11:25:07 EST
Hi Caspar,

Actually I reproduced with both *non-generated* and *generated* InventoryPackage.

Best regards,

Sabri.
Comment 8 Stefan Winkler CLA 2010-02-25 02:53:51 EST
Hi Sabri,

as I cannot reproduce the issue with my attempts of creating a test case, could you attach a (preferrably minimum) zipped project so that I can reproduce the problem in that way?

Thanks!
Comment 9 Sabri Skhiri CLA 2010-02-25 10:56:21 EST
Created attachment 160197 [details]
The project I used to reproduce the bug

Process:
1. I start a run-time instance of Eclipse in order to have my inventory.cdo model loaded as a bundle.
2. I start a cdo server by the exercise 06 code
3. I open a CDO session UI view, I open a session to localhost and gastro repository
4. I try to import the resto1.inventory in a new resource and the exception occurs

and even in the CDO UI Session the exception occurrs.
Comment 10 Eike Stepper CLA 2010-06-29 04:54:44 EDT
Rebasing all outstanding 3.0 problem reports to version 3.0.1
Comment 11 Eike Stepper CLA 2010-07-07 07:10:40 EDT
Fixing wrong bug version.
Comment 12 Eike Stepper CLA 2011-06-23 04:27:11 EDT
Moving all open problem reports to 4.0
Comment 13 Eike Stepper CLA 2012-06-05 07:29:34 EDT
Moving all open bug reports to 4.1 because the release is very near and it's hghly unlikely that there will be spare time to address 4.0 problems.

Please make sure that your patches can be applied against the master branch and that your problem is not already fixed there!!!
Comment 14 Eike Stepper CLA 2012-08-14 22:51:06 EDT
Moving all open issues to 4.2. Open bugs can be ported to 4.1 maintenance after they've been fixed in master.
Comment 15 Eike Stepper CLA 2013-06-29 12:16:56 EDT
We'll try to address open problems in 4.3 (master) first and then port fixes back to 4.2.
Comment 16 Eike Stepper CLA 2015-07-14 02:08:48 EDT
Moving all open bugzillas to 4.5.
Comment 17 Eike Stepper CLA 2016-07-31 00:51:44 EDT
Moving all unaddressed bugzillas to 4.6.
Comment 18 Eike Stepper CLA 2017-12-28 01:13:08 EST
Moving all open bugs to 4.7
Comment 19 Eike Stepper CLA 2019-11-08 02:14:40 EST
Moving all unresolved issues to version 4.8-
Comment 20 Eike Stepper CLA 2019-12-13 12:55:11 EST
Moving all unresolved issues to version 4.9
Comment 21 Eike Stepper CLA 2020-12-11 10:42:06 EST
Moving to 4.13.