When trying to use graphiti with CDO (4.2.0) i've run into a following problem: calling setTrackingModification(true) on diagram resource immediately results in java.util.ConcurrentModificationException.

Here is the stack trace:

java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793)
at java.util.HashMap$EntryIterator.next(HashMap.java:834)
at java.util.HashMap$EntryIterator.next(HashMap.java:832)
at org.eclipse.net4j.util.ref.ReferenceValueMap2$EntrySetIterator.hasNext(ReferenceValueMap2.java:408)
at java.util.AbstractMap$2$1.hasNext(AbstractMap.java:356)
at java.util.Collections$UnmodifiableCollection$1.hasNext(Collections.java:1007)
at org.eclipse.emf.cdo.util.CDOLazyContentAdapter.addCleanObjectHandler(CDOLazyContentAdapter.java:123)
at org.eclipse.emf.cdo.util.CDOLazyContentAdapter.setTarget(CDOLazyContentAdapter.java:61)
at org.eclipse.emf.ecore.util.EContentAdapter.setTarget(EContentAdapter.java:182)
at org.eclipse.emf.ecore.impl.MinimalEObjectImpl$1ArrayDelegatingAdapterList.didAdd(MinimalEObjectImpl.java:489)
at org.eclipse.emf.ecore.impl.MinimalEObjectImpl$1ArrayDelegatingAdapterList.didAdd(MinimalEObjectImpl.java:1)
at org.eclipse.emf.common.util.ArrayDelegatingEList.addUnique(ArrayDelegatingEList.java:389)
at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:301)
at org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl.setTrackingModification(CDOResourceImpl.java:499)

I also experience this problem recently and I was about to commit a simple fix for it. But then I looked at
CDOLazyContentAdapter a little bit longer and thought it should be reimplemented from scratch without extending
EContentAdapter. If you want me to fix the ConcurrentModificationException separately, please submit a bugzilla and I'll
look at it.

On 03-01-14 08:59, Eike Stepper wrote:
> Hi Leonid,
>
> I also experience this problem recently and I was about to commit a
> simple fix for it. But then I looked at CDOLazyContentAdapter a little
> bit longer and thought it should be reimplemented from scratch without
> extending EContentAdapter. If you want me to fix the
> ConcurrentModificationException separately, please submit a bugzilla and
Yes this is a known issue with the CDOLazyContentAdapter.
I reported this bug here:

I spend quiet some time using the CDOLazyContentAdapter and trying
to change it so it can deal with anything else than a Resource as a
root. My conclusion, it's very broken..and indeed needs to be redone.
The root cause of the concurrentmod, is that walking an object (For
example to check containment, will trigger objects to be loaded, which
will update the ObjectHandler and fire concurrentmod exception.

Am 03.01.2014 12:43, schrieb Christophe Bouhier:
> On 03-01-14 08:59, Eike Stepper wrote:
>> Hi Leonid,
>>
>> I also experience this problem recently and I was about to commit a
>> simple fix for it. But then I looked at CDOLazyContentAdapter a little
>> bit longer and thought it should be reimplemented from scratch without
>> extending EContentAdapter. If you want me to fix the
>> ConcurrentModificationException separately, please submit a bugzilla and
> Yes this is a known issue with the CDOLazyContentAdapter.
> I reported this bug here:
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=399723
That bug is more like an umbrella bug. I've now fixed the ConcurrentModificationException via:

java.lang.IllegalStateException: Different object was registered for OID3693
at org.eclipse.emf.internal.cdo.view.AbstractCDOView.registerObject(AbstractCDOView.java:1324)
at org.eclipse.emf.internal.cdo.view.AbstractCDOView.getObject(AbstractCDOView.java:923)
at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.getObject(CDOTransactionImpl.java:1150)
at org.eclipse.emf.internal.cdo.view.AbstractCDOView.convertIDToObject(AbstractCDOView.java:1255)
at org.eclipse.emf.internal.cdo.view.CDOStoreImpl.convertIDToObject(CDOStoreImpl.java:702)
at org.eclipse.emf.internal.cdo.view.CDOStoreImpl.getContainer(CDOStoreImpl.java:129)
at org.eclipse.emf.internal.cdo.CDOObjectImpl.eInternalContainer(CDOObjectImpl.java:707)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInternalResource(BasicEObjectImpl.java:929)
at org.eclipse.emf.internal.cdo.CDOObjectImpl.eInternalResource(CDOObjectImpl.java:581)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eResource(BasicEObjectImpl.java:920)
at org.eclipse.emf.internal.cdo.CDOObjectImpl.cdoResource(CDOObjectImpl.java:166)
at org.eclipse.emf.cdo.util.CDOLazyContentAdapter.isContained(CDOLazyContentAdapter.java:208)
at org.eclipse.emf.cdo.util.CDOLazyContentAdapter.addCleanObjectHandler(CDOLazyContentAdapter.java:124)
at org.eclipse.emf.cdo.util.CDOLazyContentAdapter.setTarget(CDOLazyContentAdapter.java:60)
at org.eclipse.emf.ecore.util.EContentAdapter.setTarget(EContentAdapter.java:182)
at org.eclipse.emf.ecore.impl.MinimalEObjectImpl$1ArrayDelegatingAdapterList.didAdd(MinimalEObjectImpl.java:489)
at org.eclipse.emf.ecore.impl.MinimalEObjectImpl$1ArrayDelegatingAdapterList.didAdd(MinimalEObjectImpl.java:1)
at org.eclipse.emf.common.util.ArrayDelegatingEList.addUnique(ArrayDelegatingEList.java:389)
at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:301)
at org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl.setTrackingModification(CDOResourceImpl.java:499)