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

Possible rare thread hazard in IW.commit

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments


    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.9.4, 3.0.3, 3.1, 4.0-ALPHA
    • Component/s: None
    • Labels:
    • Lucene Fields:


      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...




            • Assignee:
              mikemccand Michael McCandless
              mikemccand Michael McCandless


              • Created:

                Issue deployment