Lucene - Core
  1. Lucene - Core
  2. LUCENE-1573

IndexWriter does not do the right thing when a Thread is interrupt()'d

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9, 2.0.0, 2.1, 2.2, 2.3, 2.3.1, 2.3.2, 2.4, 2.4.1
    • Fix Version/s: 2.9
    • Component/s: core/index
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      Spinoff from here:

      http://www.nabble.com/Deadlock-with-concurrent-merges-and-IndexWriter--Lucene-2.4--to22714290.html

      When a Thread is interrupt()'d while inside Lucene, there is a risk currently that it will cause a spinloop and starve BG merges from completing.

      Instead, when possible, we should allow interruption. But unfortunately for back-compat, we will need to wrap the exception in an unchecked version. In 3.0 we can change that to simply throw InterruptedException.

      1. LUCENE-1573.patch
        42 kB
        Michael McCandless

        Activity

        Hide
        Michael McCandless added a comment -

        Attached patch. All tests pass, including a new one that showed the deadlock.

        I also found & fixed a case where IndexWriter would hang during close (thinking a BG merge was still running when it wasn't) if the InterruptedException arrived at the right time.

        I'll commit in a day or two.

        Show
        Michael McCandless added a comment - Attached patch. All tests pass, including a new one that showed the deadlock. I also found & fixed a case where IndexWriter would hang during close (thinking a BG merge was still running when it wasn't) if the InterruptedException arrived at the right time. I'll commit in a day or two.
        Hide
        Michael McCandless added a comment -

        Thanks Jeremy.

        Show
        Michael McCandless added a comment - Thanks Jeremy.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development