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

Jukka Zitting resolved OAK-1482.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 0.18

Good point about {{CopyOnWriteArrayList}}! As you noticed, the reason for not 
synchronizing the read methods is to prevent writes from blocking concurrent 
read operations. But the reads still need to access the list of tar files that 
might get concurrently modified by writes, which causes this issue. Fixed in 
revision 1572996 by using {{CopyOnWriteArrayList}} as suggested.

> ConcurrentModificationException in FileStore
> --------------------------------------------
>
>                 Key: OAK-1482
>                 URL: https://issues.apache.org/jira/browse/OAK-1482
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 0.17.1
>            Reporter: Chetan Mehrotra
>            Assignee: Jukka Zitting
>             Fix For: 0.18
>
>
> At times with load ConcurrentModificationException is being seen in FileStore
> {noformat}
> Caused by: java.util.ConcurrentModificationException: null
>       at 
> java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:953)
>       at java.util.LinkedList$ListItr.next(LinkedList.java:886)
>       at 
> org.apache.jackrabbit.oak.plugins.segment.file.FileStore.loadSegment(FileStore.java:285)
>       at 
> org.apache.jackrabbit.oak.plugins.segment.AbstractStore.readSegment(AbstractStore.java:85)
>       at 
> org.apache.jackrabbit.oak.plugins.segment.Segment.getSegment(Segment.java:266)
>       at 
> org.apache.jackrabbit.oak.plugins.segment.Record.getSegment(Record.java:109)
>       at 
> org.apache.jackrabbit.oak.plugins.segment.BlockRecord.read(BlockRecord.java:52)
>       at 
> org.apache.jackrabbit.oak.plugins.segment.SegmentStream.read(SegmentStream.java:163)
>       at com.google.common.io.ByteStreams.read(ByteStreams.java:828)
>       at com.google.common.io.ByteStreams.readFully(ByteStreams.java:695)
>       at 
> org.apache.jackrabbit.oak.plugins.index.lucene.OakDirectory$OakIndexFile.loadBlob(OakDirectory.java:174)
> {noformat}
> Looking at the code of FileStore[1] in {{writeSegment}} call the list of 
> data/bulk files gets modified. This method is marked as synchronized but 
> other methods {{loadSegment}} are not synchronized. This might cause the 
> iterators to fail. Probably using {{CopyOnWriteArrayList}} would help
> https://github.com/apache/jackrabbit-oak/blob/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java#L301



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to