DataNucleus JIRA is now in read-only mode. Raise any new issues in GitHub against the plugin that it applies to. DataNucleus JIRA will remain for the foreseeable future but will eventually be discontinued
Issue Details (XML | Word | Printable)

Key: NUCCORE-559
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Erik Bengtson
Reporter: Bennie Schut
Votes: 0
Watchers: 1
Operations

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

Concurrency Bug: unsynchronized WeakHashMap in

Created: 02/Sep/10 07:00 AM   Updated: 20/Oct/10 09:29 AM   Resolved: 12/Sep/10 10:25 AM
Component/s: None
Affects Version/s: 2.0.3
Fix Version/s: 2.2.0.m2

File Attachments: 1. Text File NUCCORE-559-1.patch (1 kB)



 Description  « Hide
Somewhat similar story as NUCCORE-553. We have hanging threads using 100% cpu.
Is it allowed to have multiple threads calling the JDOClassLoaderResolver? Since it's using the non threadsafe WeakValueMap on the offending code.

"pool-1-thread-41" prio=10 tid=0x00007fb60bc5b800 nid=0x63a2 runnable [0x0000000040f75000]
   java.lang.Thread.State: RUNNABLE
        at java.util.HashMap.get(HashMap.java:303)
        at org.datanucleus.util.ReferenceValueMap.get(ReferenceValueMap.java:186)
        at org.datanucleus.JDOClassLoaderResolver.classForName(JDOClassLoaderResolver.java:185)
        at org.datanucleus.JDOClassLoaderResolver.classForName(JDOClassLoaderResolver.java:415)
        at org.datanucleus.store.rdbms.sql.expression.SQLExpressionFactory.newExpression(SQLExpressionFactory.java:159)
        at org.datanucleus.store.rdbms.scostore.RDBMSMapEntrySetStore.getSQLStatementForIterator(RDBMSMapEntrySetStore.java:327)
        at org.datanucleus.store.rdbms.scostore.RDBMSMapEntrySetStore.iterator(RDBMSMapEntrySetStore.java:222)
        - locked <0x0000000783023778> (a org.datanucleus.store.rdbms.scostore.RDBMSMapEntrySetStore)
        at org.datanucleus.sco.SCOUtils.populateMapDelegateWithStoreData(SCOUtils.java:985)
        at org.datanucleus.sco.backed.Map.loadFromStore(Map.java:291)
        at org.datanucleus.sco.backed.Map.load(Map.java:262)
        at org.datanucleus.state.JDOStateManagerImpl.loadUnloadedFields(JDOStateManagerImpl.java:1572)
        at org.datanucleus.jdo.state.Hollow.transitionRetrieve(Hollow.java:161)
        at org.datanucleus.state.AbstractStateManager.retrieve(AbstractStateManager.java:469)
        at org.datanucleus.ObjectManagerImpl.retrieveObject(ObjectManagerImpl.java:1047)
        at org.datanucleus.jdo.JDOPersistenceManager.jdoRetrieve(JDOPersistenceManager.java:547)
        at org.datanucleus.jdo.JDOPersistenceManager.retrieve(JDOPersistenceManager.java:564)
        - locked <0x0000000782a57bb8> (a org.datanucleus.jdo.JDOPersistenceManager)
        at org.datanucleus.jdo.JDOPersistenceManager.retrieve(JDOPersistenceManager.java:573)
        - locked <0x0000000782a57bb8> (a org.datanucleus.jdo.JDOPersistenceManager)
        at org.apache.hadoop.hive.metastore.ObjectStore.getMTable(ObjectStore.java:598)



Sort Order: Ascending order - Click to sort in descending order
Bennie Schut added a comment - 03/Sep/10 07:03 AM
Using Collections.synchronizedMap solved this problem for us. Just added a patch as example.

Erik Bengtson added a comment - 12/Sep/10 10:25 AM
thanks for the patch