Lucene - Core
  1. Lucene - Core
  2. LUCENE-1200

IndexWriter.addIndexes* can deadlock in rare cases

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4
    • Fix Version/s: 2.3.2, 2.4
    • Component/s: core/index
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      In somewhat rare cases it's possible for addIndexes to deadlock
      because it is a synchronized method.

      Normally the merges that are necessary for addIndexes are done
      serially (with the primary thread) because they involve segments from
      an external directory. However, if mergeFactor of these merges
      complete then a merge becomes necessary for the merged segments, which
      are not external, and so it can run in the background. If too many BG
      threads need to run (currently > 4) then the "pause primary thread"
      approach adopted in LUCENE-1164 will deadlock, because the addIndexes
      method is holding a lock on IndexWriter.

      This was appearing as a intermittant deadlock in the
      TestIndexWriterMerging test case.

      This issue is not present in 2.3 (it was caused by LUCENE-1164).

      The solution is to shrink the scope of synchronization: don't
      synchronize on the whole method & wrap synchronized(this) in the right
      places inside the methods.

      1. LUCENE-1200.patch
        9 kB
        Michael McCandless

        Activity

        Michael McCandless created issue -
        Hide
        Michael McCandless added a comment -

        Attached patch. I plan to commit in a day or two.

        Show
        Michael McCandless added a comment - Attached patch. I plan to commit in a day or two.
        Michael McCandless made changes -
        Field Original Value New Value
        Attachment LUCENE-1200.patch [ 12377063 ]
        Michael McCandless made changes -
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Hide
        Hoss Man added a comment -

        targeted for 2.3.2 bug fix release

        Show
        Hoss Man added a comment - targeted for 2.3.2 bug fix release
        Hoss Man made changes -
        Fix Version/s 2.3.2 [ 12313057 ]
        Michael Busch made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Mark Thomas made changes -
        Workflow jira [ 12425036 ] Default workflow, editable Closed status [ 12561830 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12561830 ] jira [ 12582900 ]

          People

          • Assignee:
            Michael McCandless
            Reporter:
            Michael McCandless
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development