Issue Details (XML | Word | Printable)

Key: LUCENE-1544
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Michael McCandless
Reporter: Doug Sale
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Lucene - Java

Deadlock: IndexWriter.addIndexes(IndexReader[])

Created: 19/Feb/09 07:21 PM   Updated: 25/Sep/09 04:23 PM
Return to search
Component/s: Index
Affects Version/s: 2.4
Fix Version/s: 2.4.1, 2.9

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works LUCENE-1544.patch 2009-02-19 11:40 PM Michael McCandless 6 kB
Java Source File Licensed for inclusion in ASF works TestAddIndexes.java 2009-02-19 07:23 PM Doug Sale 6 kB
Environment: should be ubiquitous... but, Win XP on a MacBookPro (Intel) under Eclipse (Ganymede) using default compiler/runtime

Lucene Fields: New
Resolution Date: 22/Feb/09 12:27 PM


 Description  « Hide
A deadlock issue occurs under the following circumstances
  • IndexWriter.autoCommit == true
  • IndexWriter.directory 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()).



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
No work has yet been logged on this issue.