Unsafe synchronization in CachingWrapperFilterHelper [LUCENE-2520]
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
CachingWrapperFilterHelper has unsaft synchronization as follow:
public DocIdSet getDocIdSet(IndexReader reader) throws IOException {
if (cache == null) {
cache = new WeakHashMap();
}
synchronized (cache) {
...
}
It is not safe to assgine a new object to cache before synchronizing on. it may results sycnchronize on two different object if the method is called concurrently when cache =null.
---
Migrated from [LUCENE-2520](https://issues.apache.org/jira/browse/LUCENE-2520) by Wendy Feng
Contributor guide
Research direction
Search the Java source for CachingWrapperFilterHelper and start at getDocIdSet(IndexReader reader). Examine the cache initialization and synchronization path under concurrent calls; done means the method cannot synchronize on different cache objects during first use, with the relevant existing tests passing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- search
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100