Solr4 Cloud Beta version exception org.apache.lucene.store.AlreadyClosedException: this IndexWriter is closed

StackOverflow https://stackoverflow.com/questions/12302540

  •  30-06-2021
  •  | 
  •  

Question

I recently updated from Solr 3.6 to Solr4 Beta version. I am getting the below exception while trying to update and commit the same record again and again. Can someone help on how to resolve this???

SEVERE: org.apache.solr.common.SolrException: Error opening new searcher
    at org.apache.solr.core.SolrCore.openNewSearcher(SolrCore.java:1267)
    at org.apache.solr.core.SolrCore.getSearcher(SolrCore.java:1379)
    at org.apache.solr.core.SolrCore.getSearcher(SolrCore.java:1157)
    at org.apache.solr.update.DirectUpdateHandler2.commit(DirectUpdateHandler2.java:560)
    at org.apache.solr.update.processor.RunUpdateProcessor.processCommit(RunUpdateProcessorFactory.java:87)
    at org.apache.solr.update.processor.UpdateRequestProcessor.processCommit(UpdateRequestProcessor.java:64)
    at org.apache.solr.update.processor.DistributedUpdateProcessor.processCommit(DistributedUpdateProcessor.java:959)
    at org.apache.solr.update.processor.LogUpdateProcessor.processCommit(LogUpdateProcessorFactory.java:157)
    at org.apache.solr.handler.RequestHandlerUtils.handleCommit(RequestHandlerUtils.java:69)
    at org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:68)
    at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
    at org.apache.solr.core.SolrCore.execute(SolrCore.java:1656)
    at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:454)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:275)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.ha.session.JvmRouteBinderValve.invoke(JvmRouteBinderValve.java:219)
    at org.apache.catalina.ha.tcp.ReplicationValve.invoke(ReplicationValve.java:333)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1812)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
Caused by: org.apache.lucene.store.AlreadyClosedException: this IndexWriter is closed
    at org.apache.lucene.index.IndexWriter.ensureOpen(IndexWriter.java:553)
    at org.apache.lucene.index.IndexWriter.ensureOpen(IndexWriter.java:558)
    at org.apache.lucene.index.IndexWriter.nrtIsCurrent(IndexWriter.java:4061)
    at org.apache.lucene.index.StandardDirectoryReader.doOpenFromWriter(StandardDirectoryReader.java:261)
    at org.apache.lucene.index.StandardDirectoryReader.doOpenIfChanged(StandardDirectoryReader.java:240)
    at org.apache.lucene.index.StandardDirectoryReader.doOpenIfChanged(StandardDirectoryReader.java:230)
    at org.apache.lucene.index.DirectoryReader.openIfChanged(DirectoryReader.java:166)
    at org.apache.solr.core.SolrCore.openNewSearcher(SolrCore.java:1213)
    ... 30 more
Was it helpful?

Solution

In the query section of the SolrConfig.xml increase the number of MaxWarmingsearches and set the useColdSearcher to true. You can find more information here. http://wiki.apache.org/solr/FAQ#What_does_.22exceeded_limit_of_maxWarmingSearchers.3DX.22_mean.3F

<query>
 <useColdSearcher>true</useColdSearcher>
 <maxWarmingSearchers>6</maxWarmingSearchers>
</query>

Update after attending the SolrCloud BootCamp and taking the input's of the Solr team there.

  • If you increase the number of Warming Searchers, it would help in reducing the above exception, but it does not help with the Searching.
  • Searches like Faceting, Grouping, Function Queries use the Max Warming Searchers, so if you are seeing the above exception they recommend to reduce the number of commits. Increasing the maxWarmingSearchers, would not do you any help.

  • They recommend one commit every second. If you are planning on doing 100 commits every second and want to see real time updates, you could do that by turning off the maxWarmingSearchers. But if you turn this off, queries like faceting and grouping would take more time.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top