benwtrent commented on issue #13127: URL: https://github.com/apache/lucene/issues/13127#issuecomment-1986327081
OK, looking at where they are used, it seems like they were attempted to be synchronized, but we aren't synchronizing on the same things, which could cause a race condition. Particularly right here: https://github.com/apache/lucene/blob/40060f8b7080d06a218518445a0a1dfc520c812a/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterFlushControl.java#L572-L576 ``` documentsWriter.resetDeleteQueue(newQueue); ``` Is synchronized, and so is ``` documentsWriter.getNextSequenceNumber() ``` However, in this window of resetting the queue & gathering seqNo, `documentsWriter` isn't locked. So `getNextSequenceNumber` could be called. Thus calling `getNextSequenceNumber()` on the old queue, after maxSeqNo is figured out for the NEW queue. I think the solution might be to encapsulate the `resetDeleteQueue` so that `deleteQueue.advanceQueue` is synchronized with `getNextSequenceNumber`. I will push a PR to that effect. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org