lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler (JIRA)" <j...@apache.org>
Subject [jira] Commented: (LUCENE-2520) Unsafe synchronization in CachingWrapperFilterHelper
Date Wed, 30 Jun 2010 06:23:50 GMT

    [ https://issues.apache.org/jira/browse/LUCENE-2520?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12883803#action_12883803
] 

Uwe Schindler commented on LUCENE-2520:
---------------------------------------

We discussed several times about that, this is not a problem here, as its a cache and there
is no guarantee needed that every object only exists one time. For speed issues in this filter
we decided to keep it like that. There are other places in Lucene using caches working the
same way.

> Unsafe synchronization in CachingWrapperFilterHelper
> ----------------------------------------------------
>
>                 Key: LUCENE-2520
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2520
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Search
>    Affects Versions: 3.0.1
>            Reporter: Wendy Feng
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message