lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael McCandless (JIRA)" <>
Subject [jira] Created: (LUCENE-1638) Thread safety issue can cause index corruption when autoCommit=true and multiple threads are committing
Date Fri, 15 May 2009 17:31:45 GMT
Thread safety issue can cause index corruption when autoCommit=true and multiple threads are

                 Key: LUCENE-1638
             Project: Lucene - Java
          Issue Type: Bug
          Components: Index
    Affects Versions: 2.9
            Reporter: Michael McCandless
            Assignee: Michael McCandless
             Fix For: 2.9

This is only present in 2.9 trunk, but has been there since
LUCENE-1516 was committed I believe.

It's rare to hit: it only happens if multiple calls to commit() are in
flight (from different threads) and where at least one of those calls
is due to a merge calling commit (because autoCommit is true).

When it strikes, it leaves the index corrupt because it incorrectly
removes an active segment.  It causes exceptions like this:
{code} _1e.fnm
	at org.apache.lucene.index.FieldInfos.<init>(
	at org.apache.lucene.index.SegmentReader.initialize(
	at org.apache.lucene.index.SegmentReader.get(
	at org.apache.lucene.index.SegmentReader.get(
	at org.apache.lucene.index.IndexWriter$ReaderPool.get(
	at org.apache.lucene.index.IndexWriter$ReaderPool.get(
	at org.apache.lucene.index.DocumentsWriter.applyDeletes(
	at org.apache.lucene.index.IndexWriter.applyDeletes(
	at org.apache.lucene.index.IndexWriter.doFlushInternal(
	at org.apache.lucene.index.IndexWriter.doFlush(
	at org.apache.lucene.index.IndexWriter.flush(
	at org.apache.lucene.index.IndexWriter.closeInternal(
	at org.apache.lucene.index.IndexWriter.close(
	at org.apache.lucene.index.IndexWriter.close(
	at org.apache.lucene.index.TestStressIndexing2.indexRandom(
	at org.apache.lucene.index.TestStressIndexing2.testMultiConfig(

It's caused by failing to increment changeCount inside the same
synchronized block where segmentInfos was changed, in commitMerge.
The fix is simple -- I plan to commit shortly.

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