[
https://issues.apache.org/jira/browse/SOLR-8304?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15009214#comment-15009214
]
Mike Drob commented on SOLR-8304:
---------------------------------
Another potential idea is to check whether {{writeLock}} is null, and if it is
skip the whole close method since neither flush nor rollback should be an
option at that point. I'm not super confident in this approach, though, as I
can't tell if it will lead to other leaks down the road.
> SolrIndexWriter can throw NPE during finalize if create fails
> -------------------------------------------------------------
>
> Key: SOLR-8304
> URL: https://issues.apache.org/jira/browse/SOLR-8304
> Project: Solr
> Issue Type: Bug
> Affects Versions: 4.10.3, 5.3
> Reporter: Mike Drob
> Fix For: Trunk
>
>
> When {{SolrIndexWriter.create()}} fails (likely to some IOException), then
> the finalizer can still be called on the partially constructed object
> ([ref|http://stackoverflow.com/questions/14483279/can-finalize-be-called-after-a-constructor-throws-an-exception]).
> This will lead to trying to close an index that is not fully initialized, and
> give us some not so desirable behaviour. From a 4.10.3 insance:
> {noformat}
> 2015-11-12 15:55:16,295 ERROR org.apache.solr.update.SolrIndexWriter: Error
> closing IndexWriter
> java.lang.NullPointerException
> at org.apache.lucene.index.IndexWriter.doFlush(IndexWriter.java:3237)
> at org.apache.lucene.index.IndexWriter.flush(IndexWriter.java:3210)
> at org.apache.lucene.index.IndexWriter.shutdown(IndexWriter.java:907)
> at org.apache.lucene.index.IndexWriter.close(IndexWriter.java:984)
> at org.apache.lucene.index.IndexWriter.close(IndexWriter.java:954)
> at
> org.apache.solr.update.SolrIndexWriter.close(SolrIndexWriter.java:129)
> at
> org.apache.solr.update.SolrIndexWriter.finalize(SolrIndexWriter.java:182)
> at java.lang.System$2.invokeFinalize(System.java:1270)
> at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:98)
> at java.lang.ref.Finalizer.access$100(Finalizer.java:34)
> at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:210)
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]