[ 
https://issues.apache.org/jira/browse/OPENJPA-2591?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14560197#comment-14560197
 ] 

Rick Curtis commented on OPENJPA-2591:
--------------------------------------

I haven't looked at the code for this problem, but I have a question in general 
about DynamicDataStructs because I've never come across anyone using it in the 
wild. Is it helpful for your application? If so, how much of a performance 
improvement did you observe when it is enabled?

> Missing synchronisation when using "openjpa. DynamicDataStructs" 
> -----------------------------------------------------------------
>
>                 Key: OPENJPA-2591
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2591
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: Enhance
>    Affects Versions: 2.4.0
>            Reporter: Philipp Marx
>            Priority: Minor
>
> When using "DynamicDataStructs=true" there is a chance of running into an 
> ClassFormatError due to multiple enhancing of persistent classes:
> java.lang.ClassFormatError: Duplicate field name&signature in class file 
> <class-name-strippted>openjpapcdatadatacache
>       at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.7.0_75]
>       at java.lang.ClassLoader.defineClass(ClassLoader.java:800) ~[?:1.7.0_75]
>       at java.lang.ClassLoader.defineClass(ClassLoader.java:643) ~[?:1.7.0_75]
>       at serp.bytecode.BCClassLoader.findClass(BCClassLoader.java:50) 
> ~[org.apache.servicemix.bundles.serp-1.15.1_1.jar:?]
>       at java.lang.ClassLoader.loadClass(ClassLoader.java:425) ~[?:1.7.0_75]
>       at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ~[?:1.7.0_75]
>       at java.lang.Class.forName0(Native Method) ~[?:1.7.0_75]
>       at java.lang.Class.forName(Class.java:274) ~[?:1.7.0_75]
>       at 
> org.apache.openjpa.enhance.DynamicStorageGenerator.createFactory(DynamicStorageGenerator.java:169)
>  ~[openjpa-2.4.0.jar:2.4.0]
>       at 
> org.apache.openjpa.enhance.DynamicStorageGenerator.generateStorage(DynamicStorageGenerator.java:124)
>  ~[openjpa-2.4.0.jar:2.4.0]
>       at 
> org.apache.openjpa.enhance.PCDataGenerator.generateStorage(PCDataGenerator.java:115)
>  ~[openjpa-2.4.0.jar:2.4.0]
>       at 
> org.apache.openjpa.enhance.PCDataGenerator.generatePCData(PCDataGenerator.java:92)
>  ~[openjpa-2.4.0.jar:2.4.0]
>       at 
> org.apache.openjpa.datacache.DataCacheStoreManager.newPCData(DataCacheStoreManager.java:797)
>  ~[openjpa-2.4.0.jar:2.4.0]
>       at 
> org.apache.openjpa.datacache.DataCacheStoreManager.updateCaches(DataCacheStoreManager.java:144)
>  ~[openjpa-2.4.0.jar:2.4.0]
>       at 
> org.apache.openjpa.datacache.DataCacheStoreManager.commit(DataCacheStoreManager.java:87)
>  ~[openjpa-2.4.0.jar:2.4.0]
> The issue happens if the enhancing hasn't been performed yet and multiple 
> threads concurrently commit a transaction. They will both call 
> PCDataGenerator#generateStorage with the same class. This should be guarded 
> with some kind of synchronisation around the underlying map (containing the 
> enhanced classes). It's hard to provide a test case for this but keeping a 
> breakpoint open in #generateStorage and committing multiple threads will lead 
> to the exception above.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to