Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 327529 - ConcurrentModificationException in BranchRevisionCache
Summary: ConcurrentModificationException in BranchRevisionCache
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.core (show other bugs)
Version: 4.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Eike Stepper CLA
QA Contact: Eike Stepper CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-12 04:54 EDT by Pascal Lehmann CLA
Modified: 2011-06-23 03:40 EDT (History)
0 users

See Also:


Attachments
Proposed patch (2.31 KB, patch)
2010-10-12 04:57 EDT, Pascal Lehmann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pascal Lehmann CLA 2010-10-12 04:54:32 EDT
Build Identifier: 4.0

Just recenty stumbled over this stacktrace while testing:

Caused by: 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.emf.cdo.internal.common.revision.cache.branch.BranchRevisionCache.getRevisions(BranchRevisionCache.java:206)
	at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.createRevisionAvailabilityInfo(CDOTransactionImpl.java:371)
	at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.merge(CDOTransactionImpl.java:340)
... 42 more

It happened in 1 of our 10'000 random tests, couldn't reproduce since.
But when looking at BranchRevisionCache, it looks as if access to revisionLists is not consistently synchronized.

Reproducible: Sometimes
Comment 1 Pascal Lehmann CLA 2010-10-12 04:57:30 EDT
Created attachment 180652 [details]
Proposed patch

Added synchronized access to revisionList.

1) The number of lines that you changed is smaller than 250.
confirmed.
2) You are the only author of these changed lines.
confirmed.
3) You apply the EPL to these changed lines.
confirmed.
Comment 2 Eike Stepper CLA 2010-10-13 03:13:12 EDT
As such the synchronizations in getAllRevisions() and getRevisions(CDOBranchPoint) limit concurrency a lot if called. But these methods are really not supposed to be called in regular server operations. Currently they're only called on the client, which seems acceptable. So we probably don't need more opimized solutions ;-)

Committed to HEAD
Comment 3 Eike Stepper CLA 2011-06-23 03:40:56 EDT
Available in R20110608-1407