Mike Drob created SOLR-8304:
-------------------------------

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

Reply via email to