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

Mark Miller commented on SOLR-3699:
-----------------------------------

hmm...I have to look closer than just at the patch, but the setDirFactory 
method seems a little troubling - why do we do that instead of making it part 
of the constructor? What if you don't set it?

{code}
+        if (null != directoryFactory) {
+          // :HACK: normally we rely on updateHandler to do this, 
+          // but what if updateHandler failed to init?
+          directoryFactory.close();
+        }
{code}

I don't think you want that? The dir factory should and will be closed by the 
DefaultSolrCoreState when it's ref count hits 0 - you don't actually want to 
close it when closing a core.

Otherwise, the basic idea seems fine - if the IW fails, release it's dir.
                
> SolrIndexWriter constructor leaks Directory if Exception creating 
> IndexWriterConfig
> -----------------------------------------------------------------------------------
>
>                 Key: SOLR-3699
>                 URL: https://issues.apache.org/jira/browse/SOLR-3699
>             Project: Solr
>          Issue Type: Bug
>            Reporter: Robert Muir
>            Assignee: Mark Miller
>             Fix For: 4.0
>
>         Attachments: SOLR-3699.patch, SOLR-3699.patch, SOLR-3699.patch, 
> SOLR-3699.patch
>
>
> in LUCENE-4278 i had to add a hack to force SimpleFSDir for 
> CoreContainerCoreInitFailuresTest, because it doesnt close its Directory on 
> certain errors.
> This might indicate a problem that leaks happen if certain errors happen 
> (e.g. not handled in finally)

--
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-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to