You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Uwe Schindler (JIRA)" <ji...@apache.org> on 2013/02/25 20:06:12 UTC

[jira] [Commented] (LUCENE-4796) NamedSPILoader.reload needs to be synchronized

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

Uwe Schindler commented on LUCENE-4796:
---------------------------------------

Hoss: I agree!

The concurrency issue in NamedSPILoader can indeed be solved by making the reload method synchonized. The services field is volatile, so readers will in any case see the correct value, otherwise all methods would need to be synchronized. By using a voltile, we only need to synchronize this single method.
                
> NamedSPILoader.reload needs to be synchronized
> ----------------------------------------------
>
>                 Key: LUCENE-4796
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4796
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Hoss Man
>            Assignee: Hoss Man
>             Fix For: 4.2, 5.0
>
>
> Spun off of SOLR-4373: as discsused with uwe on IRC, NamedSPILoader.reload is not thread safe: it reads from this.services at the beginging of hte method, makes additions based on the method input, and then overwrites this.services at the end of the method.  if the method is called by two threads concurrently, the entries added by threadB could be lost if threadA enters the method before threadB and exists the method after threadB

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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