Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#211 Threading issue in FieldSortedHitQueue::getCachedComparator

open
nobody
core (32)
9
2012-10-23
2012-10-23
Anonymous
No

CLucene v2.3.3.4, 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:

http://comments.gmane.org/gmane.comp.jakarta.lucene.clucene.devel/1579

I also don't see the fix described in the response above (i.e. returning the stored comparator) in v2.3.3.4.

Discussion


  • Anonymous
    2012-10-23

    • priority: 5 --> 9