You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Jeremy Bauer (JIRA)" <ji...@apache.org> on 2008/07/07 16:41:31 UTC

[jira] Updated: (OPENJPA-653) Concurrency issue with query cache enabled

     [ https://issues.apache.org/jira/browse/OPENJPA-653?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jeremy Bauer updated OPENJPA-653:
---------------------------------

    Attachment: OPENJPA-653.patch

Attaching patch for 1.2.0/trunk which synchronizes the data tree map over QueryResult construction.  I considered making the TreeMap object a synchronized sorted map, but the JavaDoc indicated that an external synch was still necessary when iterating the collection.  Sadly, due to the nature of the problem I have not been able to produce a jUnit which reproduces the failure.  If I am able to produce a test I will post it at a later date.

Please review and if no issues, commit for 1.2.0.  



> Concurrency issue with query cache enabled
> ------------------------------------------
>
>                 Key: OPENJPA-653
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-653
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: datacache
>    Affects Versions: 1.2.0
>            Reporter: Jeremy Bauer
>         Attachments: OPENJPA-653.patch
>
>
> A Java EE application with query result caching enabled and with many concurrent users is failing with a ConcurrentModificationException in org.apache.openjpa.datacache.QueryCacheStoreQuery.  Specifically, the failure is in the inner class.method CachingResultObjectProvider.checkFinished(Object, boolean) and occurs while iterating the _data TreeMap within the QueryResult constructor.  
> Examination of this method showed that the tree map is synchronized in the beginning of the method and then later when the  map is cleared in abortCaching().  It is not synchronized when a new QueryResult is constructed.  This allows a thread to iterate over the map (during the constructor) while another thread is modifying it.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.