Issue Details (XML | Word | Printable)

Key: NUCCORE-234
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Incomplete Incomplete
Assignee: Andy Jefferson
Reporter: Yang ZHONG
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DataNucleus Core

Multithreaded PersistenceManagerFactory still ConcurrentModificationException when getting FetchGroup

Created: 30/Mar/09 07:25 PM   Updated: 26/Apr/10 03:37 PM   Resolved: 19/Apr/10 08:39 AM
Component/s: JDO
Affects Version/s: 1.1.1
Fix Version/s: 2.1.0.m2

File Attachments: 1. Text File NUCCORE-234-core.patch (7 kB)

Environment: Linux, Java 5 & 6

Forum Thread URL: HTTP://WWW.JPOx.org/servlet/forum/viewthread_thread,5405
Datastore: IBM DB2
Severity: Production


 Description  « Hide
Thanks a lot to Erik for having fixed HTTP://WWW.JPOx.org/servlet/jira/browse/NUCCORE-170 in 1.1.1. No more ConcurrentModificationException for removeFetchGroup & addFetchGroup. However, there're some for getFetchGroup now:

java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:1036)
at java.util.HashMap$KeyIterator.next(HashMap.java:1073)
at org.datanucleus.jdo.JDOPersistenceManagerFactory.getFetchGroup(JDOPersistenceManagerFactory.java:1783)

Sort Order: Ascending order - Click to sort in descending order
Peter Dettman added a comment - 19/Apr/10 06:55 AM
Proposed patch against 'core' project:

1. Changes to JDOPersistenceManagerFactory to fix race conditions around access to 'jdoFetchGroups' field.

2. Fix for FetchGroupManagerTest.testMultithreadedAccess, which intermittently fails for reasons internal to the test case itself.

3. JDOPersistenceManagerFactory.getFetchGroups changed to conform to API by returning a mutable copy of the fetch groups.

Peter Dettman added a comment - 19/Apr/10 06:58 AM
Re-upload as project-relative patch

Peter Dettman added a comment - 19/Apr/10 07:40 AM
Updated patch to include:

4. Add synchronized keyword to ObjectManagerFactoryImpl.getFetchGroupManager

Andy Jefferson added a comment - 19/Apr/10 08:39 AM
Thx for the patch. Applied to SVN trunk apart from the part that set "jdoFetchGroups" on initialisation; need to keep a PMF as small as possible and most use-cases won't have any fetch groups defined dynamically. Also completed one TODO in the patch in PMF.close().

If you were wanting to contribute to DataNucleus on a more regular basis we could arrange commit rights, but please only consider this if you will be committing reasonably regularly. If so, post on the volunteer forum with the agreement text.