CLucene v18.104.22.168, Win2K8 Server, x64, VS 2010
When two threads A and B enter FieldSortedHitQueue::getCachedComparator looking for a reader/fieldname combination that hasn't been cached yet, they will both allocate comparators (two in total) and will both go into FieldSortedHitQueue::store with their comparators. Thread A will put its comparator into the reader cache and will then return it to the caller. Thread B will find the comparator allocated by thread A and will call _this::remove(k) inside CLHashMap::put, which will delete the stored comparator and put there the comparator allocated by thread B. Thread A is still using the deleted object and it crashes.
Strangely enough, this issue was reported back in 2006:
I also don't see the fix described in the response above (i.e. returning the stored comparator) in v22.214.171.124.
Log in to post a comment.