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

Bug 325513

Summary: Mismatch between CDO_RESOURCE__RESOURCE_SET and RESOURCE__RESOURCE_SET
Product: [Modeling] EMF Reporter: Martin Fluegge <martin.fluegge>
Component: cdo.coreAssignee: Martin Fluegge <martin.fluegge>
Status: CLOSED FIXED QA Contact: Eike Stepper <stepper>
Severity: normal    
Priority: P3 Flags: stepper: review+
Version: 3.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Patch v2 none

Description Martin Fluegge CLA 2010-09-16 14:34:09 EDT
Cloned from: 314186: Mismatch between CDO_RESOURCE__RESOURCE_SET and RESOURCE__RESOURCE_SET
https://bugs.eclipse.org/bugs/show_bug.cgi?id=314186

I am working on a complex GMF editor for my employer.  The editor has been stable for some months now.  We have recently begun integrating CDO and have encountered this issue when closing our transactions.  From my limited perspective it seems that when the CDO transaction is closed it ends up triggering some resource set changes.  Among these changes is an operation that sets the feature "Resource.RESOURCE__RESOURCE_SET" to value "null".  That feature id normally has a value of 0.  When CDO translates the notification in "BasicEObjectImpl.eDerivedStructuralFeatureID(EStructuralFeature)" it resolves the feature id to "EresourcePackage.CDO_RESOURCE__RESOURCE_SET", which apparently has a value of 3 (there is some math involved in computing it).  This causes a notification filter to treat the value as a boolean, which causes an exception that seems to disrupt the closing of the transaction.

From what I can see this prevents the transaction from successfully closing, which in turn prevents us from opening any more views in that ResourceSet.

!ENTRY org.eclipse.emf.transaction 4 45 2010-05-24 17:31:33.116
!MESSAGE Uncaught exception during post-commit listener notifications
!STACK 0
java.lang.IllegalStateException
	at org.eclipse.emf.common.notify.impl.NotificationImpl.getOldBooleanValue(NotificationImpl.java:883)
	at org.eclipse.gmf.runtime.emf.core.resources.GMFResourceModificationManager$1.matches(GMFResourceModificationManager.java:130)
	at org.eclipse.emf.transaction.NotificationFilter$13.matches(NotificationFilter.java:291)
	at org.eclipse.emf.transaction.impl.FilterManager.selectUnbatched(FilterManager.java:144)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl$2.run(TransactionalEditingDomainImpl.java:822)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.runExclusive(TransactionalEditingDomainImpl.java:328)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.broadcastUnbatched(TransactionalEditingDomainImpl.java:818)
	at org.eclipse.gmf.runtime.diagram.core.DiagramEditingDomainFactory$DiagramEditingDomain.broadcastUnbatched(DiagramEditingDomainFactory.java:159)
	at org.eclipse.emf.transaction.impl.TransactionChangeRecorder.appendNotification(TransactionChangeRecorder.java:319)
	at org.eclipse.emf.transaction.impl.TransactionChangeRecorder.processResourceNotification(TransactionChangeRecorder.java:272)
	at org.eclipse.emf.transaction.impl.TransactionChangeRecorder.notifyChanged(TransactionChangeRecorder.java:238)
	at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:380)
	at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$InternalSettingDelegateSingleData.dynamicSet(EStructuralFeatureImpl.java:2029)
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicSet(BasicEObjectImpl.java:1137)
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjectImpl.java:1111)
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjectImpl.java:1081)
	at org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl.setResourceSet(CDOResourceImpl.java:212)
	at org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl.basicSetResourceSet(CDOResourceImpl.java:843)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$ResourcesEList.inverseRemove(ResourceSetImpl.java:595)
	at org.eclipse.emf.common.notify.impl.NotifyingListImpl.removeAll(NotifyingListImpl.java:951)
	at org.eclipse.emf.internal.cdo.view.CDOViewSetImpl.remove(CDOViewSetImpl.java:171)
	at org.eclipse.emf.internal.cdo.session.CDOSessionImpl.viewDetached(CDOSessionImpl.java:429)
	at org.eclipse.emf.internal.cdo.view.CDOViewImpl.doDeactivate(CDOViewImpl.java:1814)
	at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.doDeactivate(CDOTransactionImpl.java:1792)
	at org.eclipse.net4j.util.lifecycle.Lifecycle.deactivate(Lifecycle.java:125)
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:183)
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:173)
	at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:199)
	at org.eclipse.emf.internal.cdo.view.CDOViewImpl.close(CDOViewImpl.java:1697)
Comment 1 Martin Fluegge CLA 2010-09-16 14:36:24 EDT
Created attachment 179058 [details]
Patch v2

Since this patch does not break any API or leads to other version problems I suggest to apply it to the maintenance branch.
Comment 2 Eike Stepper CLA 2010-09-17 12:40:19 EDT
Committed to HEAD
Comment 3 Martin Fluegge CLA 2010-09-17 14:14:20 EDT
I think you meant 
'Committed to R3_0_maintenance'
;)
Comment 4 Eike Stepper CLA 2010-09-17 22:57:29 EDT
You got me ;-)
Comment 5 Eike Stepper CLA 2011-06-23 04:27:16 EDT
Moving all open problem reports to 4.0
Comment 6 Eike Stepper CLA 2012-09-21 06:36:46 EDT
Undoing accidental version change.
Comment 7 Eike Stepper CLA 2012-09-21 06:51:53 EDT
Closing.