Issue: IndexWriter of a specific core has been closed as a result of NullPointerException at "SchemaSimilarityFactory.SchemaSimilarity.get" when updating one of the documents. After this exception, Solr stops indexing the next documents to this specific core and we have to restart the Solr process in order to reopen IndexWriter of this specific core.
Cause: Raise condition between multiple threads that perform read/write to the same object. In this case, it is *volatile SolrCore core* in SchemaSimilarityFactory. One thread calls inform() of SchemaSimilarityFactory with the new object of SolrCore that is still under initialization (write operation) When at the same time, another thread performs core.getLatestSchema() (at SchemaSimilarityFactory.SchemaSimilarity.get) of this new SolrCore object that still has not been fully initialized (read operation) When inform of SchemaSimilarityFactory is called (write operation): • During the creation of the new core • During uploading transient core to transient cache • During loading non-transient core to the memory (during Solr startup by coreLoadExecutor thread) When SchemaSimilarityFactory.SchemaSimilarity.get Similarity is called (read operation) • During indexing document It seems like a bug in SolrCore.setLatestSchema() The infrom() is called before initialization of schema Stack of thread that performs inform: at org.apache.solr.search.similarities.SchemaSimilarityFactory.inform(SchemaSimilarityFactory.java:97) at org.apache.solr.core.SolrCore.setLatestSchema(SolrCore.java:319) at org.apache.solr.core.SolrCore.initSchema(SolrCore.java:1139) at org.apache.solr.core.SolrCore.<init>(SolrCore.java:947) at org.apache.solr.core.SolrCore.<init>(SolrCore.java:870) at org.apache.solr.core.CoreContainer.createFromDescriptor(CoreContainer.java:1189) at org.apache.solr.core.CoreContainer.getCore(CoreContainer.java:1721) at org.apache.solr.servlet.HttpSolrCall.init(HttpSolrCall.java:249) at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:469) at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:395) at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:341) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1602) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1588) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1557) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:220) Stack of thread that performs get: org.apache.solr.common.SolrException: Exception writing document id *** to the index; possible analysis error. at org.apache.solr.update.DirectUpdateHandler2.addDoc(DirectUpdateHandler2.java:250) at org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:67) at org.apache.solr.update.processor.UpdateRequestProcessor.processAdd(UpdateRequestProcessor.java:55) at org.apache.solr.update.processor.DistributedUpdateProcessor.doLocalAdd(DistributedUpdateProcessor.java:1002) at org.apache.solr.update.processor.DistributedUpdateProcessor.doVersionAdd(DistributedUpdateProcessor.java:1233) at org.apache.solr.update.processor.DistributedUpdateProcessor.lambda$versionAdd$2(DistributedUpdateProcessor.java:1082) at org.apache.solr.update.processor.DistributedUpdateProcessor$$Lambda$344/00000000A4008F60.apply(Unknown Source) at org.apache.solr.update.VersionBucket.runWithLock(VersionBucket.java:50) at org.apache.solr.update.processor.DistributedUpdateProcessor.versionAdd(DistributedUpdateProcessor.java:1082) at org.apache.solr.update.processor.DistributedUpdateProcessor.processAdd(DistributedUpdateProcessor.java:694) at org.apache.solr.update.processor.UpdateRequestProcessor.processAdd(UpdateRequestProcessor.java:55) ............... Caused by: java.lang.NullPointerException at org.apache.solr.search.similarities.SchemaSimilarityFactory$SchemaSimilarity.get(SchemaSimilarityFactory.java:145) at org.apache.lucene.search.similarities.PerFieldSimilarityWrapper.computeNorm(PerFieldSimilarityWrapper.java:45) at org.apache.lucene.index.DefaultIndexingChain$PerField.finish(DefaultIndexingChain.java:752) at org.apache.lucene.index.DefaultIndexingChain.processDocument(DefaultIndexingChain.java:400) at org.apache.lucene.index.DocumentsWriterPerThread.updateDocument(DocumentsWriterPerThread.java:251) at org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:494) at org.apache.lucene.index.IndexWriter.updateDocument(IndexWriter.java:1616) at org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1235) at org.apache.solr.update.DirectUpdateHandler2.allowDuplicateUpdate(DirectUpdateHandler2.java:326) at org.apache.solr.update.DirectUpdateHandler2.addDoc0(DirectUpdateHandler2.java:291) at org.apache.solr.update.DirectUpdateHandler2.addDoc(DirectUpdateHandler2.java:235) ... 71 more -- Sent from: https://lucene.472066.n3.nabble.com/Solr-Dev-f506503.html --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org