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

Bug 368331

Summary: CDOStateMachine.detach() is not robust against sideeffects of process() call
Product: [Modeling] EMF Reporter: Ronald Krijgsheld <rkrijgsheld>
Component: cdo.coreAssignee: Eike Stepper <stepper>
Status: CLOSED WORKSFORME QA Contact: Eike Stepper <stepper>
Severity: normal    
Priority: P3 CC: stepper
Version: 4.2   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
testcase none

Description Ronald Krijgsheld CLA 2012-01-11 06:21:06 EST
Build Identifier: 

The detach() method determines a set of objects to detach. then calls process() to update the statemachine, however this method calls objectStateChanged to its listeners. That in turn leads to objects that can be detached. 

The effect is that the processing after the process() call can never assume the the objectsToDetach collection are not already detached by a listener.    

Reproducible: Sometimes
Comment 1 Ronald Krijgsheld CLA 2012-01-11 08:29:55 EST
Created attachment 209308 [details]
testcase
Comment 2 Ronald Krijgsheld CLA 2012-01-11 08:34:45 EST
the resulting stacktrace:

java.lang.NullPointerException
	at java.util.concurrent.ConcurrentHashMap.remove(Unknown Source)
	at org.eclipse.emf.internal.cdo.transaction.CDOSavepointImpl$1.put(CDOSavepointImpl.java:74)
	at org.eclipse.emf.internal.cdo.transaction.CDOSavepointImpl$1.put(CDOSavepointImpl.java:1)
	at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.detachObject(CDOTransactionImpl.java:1365)
	at org.eclipse.emf.internal.cdo.view.CDOStateMachine.detach(CDOStateMachine.java:286)
	at org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl.detached(CDOResourceImpl.java:1322)
	at org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl$ContentsCDOList.inverseRemove(CDOResourceImpl.java:1575)
	at org.eclipse.emf.common.notify.impl.DelegatingNotifyingListImpl.remove(DelegatingNotifyingListImpl.java:731)
	at org.eclipse.emf.common.util.DelegatingEList.remove(DelegatingEList.java:506)
	at org.eclipse.emf.cdo.tests.Test368331.testDetach(Test368331.java:52)
Comment 3 Eike Stepper CLA 2012-08-14 22:50:54 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 4 Eike Stepper CLA 2012-11-01 02:40:38 EDT
The test case passes and is committed. Maybe the problem has been fixed via a different bugzilla.

commit 3c5eb544ff2e8db8e94fe2cf97033a2affe403b4
Comment 5 Eike Stepper CLA 2013-06-27 04:00:57 EDT
Closing