Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-2782

Possible rare thread hazard in IW.commit


    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.9.4, 3.0.3, 3.1, 4.0-ALPHA
    • None
    • None
    • New


      I was seeing a very rare intermittent failure in TestIndexWriter.testCommitThreadSafety.

      The issue happens if one thread calls commit while another is flushing, and is exacerbated at high flush rates (eg maxBufferedDocs=2). The thread doing commit will first flush, and then it syncs the files. However in between those two, if other threads manage to add enough docs and trigger another flush, a 2nd new segment can sneak into the SegmentInfos before we sync.

      This is normally harmless, in that it just means the commit includes a few more docs that had been added by other threads, so it's fine. But, it can mean that a committed segment references the still-open doc store files. Our tests now catch this (I changed MockDirWrapper to throw an exception in this case), and so testCommitThreadSafety can fail with this exception. If you hardwire the maxBufferedDocs to 2 it happens quite often.

      It's not clear this is really a problem in real apps vs just our anal MockDirWrapper but I think we should fix it...




            mikemccand Michael McCandless
            mikemccand Michael McCandless
            0 Vote for this issue
            0 Start watching this issue