vigyasharma commented on PR #633:
URL: https://github.com/apache/lucene/pull/633#issuecomment-1140109855

   @mikemccand Thanks for beasting it and uncovering this issue! 
   I tried to do the same on my box but haven't had any luck so far. Any ideas 
on how I can make it more likely to happen? How many cores (and threads) did 
you run this on?
   
   Side Note: it might be helpful to have a gradle parameter for thread count 
for concurrency tests. Maybe something that goes with the 
[Concurrent](https://issues.apache.org/jira/browse/LUCENE-10566) test group? 
I'm not sure if there's one for this already (the test seems hardcoded to `int 
numThreads = TEST_NIGHTLY ? 5 : 2;`.
   
   I tried reading through code to figure this out. I suspect this is because 
the `synchronized AddIndexesMergeSource::getNextMerge()` function is really 
locking on the inner class object, and not on IndexWriter. This works fine for 
`pendingAddIndexesMerges` because that is an inner class object, but probably 
hits race conditions for `runningMerges` which belongs to `IndexWriter`.
   
   I could either wrap the runningMerges update with a `synchronized 
(IndexWriter.this) {}`, or make `runningMerges` a `synchronizedSet`. I like the 
second approach as it automatically fixes this at all other places. What do you 
think?
   


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

Reply via email to