lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexander Kanarsky (JIRA)" <>
Subject [jira] Updated: (LUCENE-2584) Concurrency issues in SegmentInfo.files() could lead to ConcurrentModificationException
Date Wed, 04 Aug 2010 20:24:16 GMT


Alexander Kanarsky updated LUCENE-2584:

    Attachment: LUCENE-2584-branch_3x.patch

Mike, the patches are attached. One note, I noticed (in flex_1458/trunk) that you are using
the HashSet to collect the file names and then convert it to ArrayList; while this is a good
idea to  guarantee the uniqueness of the file names, it also could mask any code that accidentally
adds the same file more than once (something that I would prefer to notice rather than mask).
So I used an assertion to ensure both the uniqueness of the names and correctness of the code
that adds names. Also, with assertions disabled, this approach adds no additional performance
overhead at all. But if you'd like to use the HashSet to collect the file names, let me know
so I will redo the patches.

> Concurrency issues in SegmentInfo.files() could lead to ConcurrentModificationException
> ---------------------------------------------------------------------------------------
>                 Key: LUCENE-2584
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Bug
>    Affects Versions: 2.9, 2.9.1, 2.9.2, 2.9.3, 3.0, 3.0.1, 3.0.2
>            Reporter: Alexander Kanarsky
>            Priority: Minor
>             Fix For: 3.1, 4.0
>         Attachments: LUCENE-2584-branch_3x.patch, LUCENE-2584-lucene-2_9.patch, LUCENE-2584-lucene-3_0.patch
> The multi-threaded call of the files() in SegmentInfo could lead to the ConcurrentModificationException
if one thread is not finished additions to the ArrayList (files) yet while the other thread
already obtained it as cached (see below). This is a rare exception, but it would be nice
to fix. I see the code is no longer problematic in the trunk (and others ported from flex_1458),
looks it was fixed while implementing post 3.x features. The fix to 3.x and 2.9.x branches
could be the same - create the files set first and populate it, and then assign to the member
variable at the end of the method. This will resolve the issue. I could prepare the patch
for 2.9.4 and 3.x, if needed.
> --
> INFO: [19] webapp= path=/replication params={command=fetchindex&wt=javabin} status=0
> Jul 30, 2010 9:13:05 AM org.apache.solr.core.SolrCore execute
> INFO: [19] webapp= path=/replication params={command=details&wt=javabin} status=0
> Jul 30, 2010 9:13:05 AM org.apache.solr.handler.ReplicationHandler doFetch
> SEVERE: SnapPull failed
> java.util.ConcurrentModificationException
>         at java.util.AbstractList$Itr.checkForComodification(
>         at java.util.AbstractList$
>         at java.util.AbstractCollection.addAll(
>         at org.apache.lucene.index.SegmentInfos.files(
>         at org.apache.lucene.index.DirectoryReader$ReaderCommit.<init>(
>         at org.apache.lucene.index.DirectoryReader.getIndexCommit(
>         at
>         at org.apache.solr.handler.SnapPuller.fetchLatestIndex(
>         at org.apache.solr.handler.ReplicationHandler.doFetch(
>         at org.apache.solr.handler.ReplicationHandler$

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

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message