On Thu, Feb 19, 2009 at 12:54 PM, Michael McCandless <> wrote:

Whoa -- please open a Jira issue?  Since we still have 2.4/2.4.1/2.9 allowing the deprecated autoCommit=true, we should fix it.

Thanks Doug.


Doug Sale wrote:

A deadlock issue occurs under the following circumstances
- IndexWriter.autoCommit == true
- contains multiple segments
- IndexWriter.AddIndex(IndexReader[]) is invoked

I put together a JUnit test that recreates the deadlock, which I've attached.  It is the first test method, 'testAddIndexByIndexReader()'.

In a nutshell, here is what happens:

       // 1) AddIndexes(IndexReader[]) acquires the write lock,
       // then begins optimization of destination index (this is
       // prior to adding any external segments).
       // 2) Main thread starts a ConcurrentMergeScheduler.MergeThread
       // to merge the 2 segments.
       // 3) Merging thread tries to acquire the read lock at
       // IndexWriter.blockAddIndexes(boolean) in
       // IndexWriter.StartCommit(), but cannot as...
       // 4) Main thread still holds the write lock, and is
       // waiting for the IndexWriter.runningMerges data structure
       // to be devoid of merges with their optimize flag
       // set (IndexWriter.optimizeMergesPending()).

I hesitate to enter this as an issue in JIRA, as it is based on a deprecated constructor (autocommit == true).  Additionally, I noted that 'IndexWriter.AddIndex(Directory[])' has been deprecated and wasn't sure of the fate of 'IndexWriter.AddIndex(IndexReader[])' in 3.0.

- Doug Sale

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

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