Possible rare thread hazard in IW.commit
----------------------------------------

                 Key: LUCENE-2782
                 URL: https://issues.apache.org/jira/browse/LUCENE-2782
             Project: Lucene - Java
          Issue Type: Bug
            Reporter: Michael McCandless
            Assignee: Michael McCandless
             Fix For: 2.9.4, 3.0.3, 3.1, 4.0


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

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to