Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OutOfMemoryError: Java heap space error when start solr

I start indexing DB articles with solr, but after add about 58 million article (and about 113 GB size of disk) , i get below error message on tomcat log error

Note1: i already set Init memory pool to 256MB, and Max memory pool:1400MB to tomcat server.
Note2: I can post or search article but must wait over 3 min for get response.

8-apr-2010 14:27:07 org.apache.solr.common.SolrException log
SEVERE: java.lang.OutOfMemoryError: Java heap space
    at org.apache.lucene.util.PriorityQueue.initialize(PriorityQueue.java:89)
    at org.apache.lucene.search.HitQueue.<init>(HitQueue.java:67)
    at org.apache.lucene.search.TopScoreDocCollector.<init>(TopScoreDocCollector.java:113)
    at org.apache.lucene.search.TopScoreDocCollector.<init>(TopScoreDocCollector.java:37)
    at org.apache.lucene.search.TopScoreDocCollector$InOrderTopScoreDocCollector.<init>(TopScoreDocCollector.java:42)
    at org.apache.lucene.search.TopScoreDocCollector$InOrderTopScoreDocCollector.<init>(TopScoreDocCollector.java:40)
    at org.apache.lucene.search.TopScoreDocCollector.create(TopScoreDocCollector.java:100)
    at org.apache.solr.search.SolrIndexSearcher.getDocListNC(SolrIndexSearcher.java:979)
    at org.apache.solr.search.SolrIndexSearcher.getDocListC(SolrIndexSearcher.java:884)
    at org.apache.solr.search.SolrIndexSearcher.search(SolrIndexSearcher.java:341)
    at org.apache.solr.handler.component.QueryComponent.process(QueryComponent.java:182)
    at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:195)
    at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:131)
    at org.apache.solr.core.SolrCore.execute(SolrCore.java:1316)
    at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:338)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)
    at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:574)
    at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1527)
    at java.lang.Thread.run(Unknown Source)

What's problem ?

Have any suggestion ?

Important Question: Why solr using heap memory ???

like image 428
Hamid Avatar asked Apr 08 '10 13:04

Hamid


People also ask

How do I fix Java heap space error?

OutOfMemoryError: Java heap space. 1) An easy way to solve OutOfMemoryError in java is to increase the maximum heap size by using JVM options "-Xmx512M", this will immediately solve your OutOfMemoryError.

How much memory does SOLR need?

If your OS, Solr's Java heap, and all other running programs require 4GB of memory, then an ideal memory size for that server is at least 12GB. You might be able to make it work with 8GB total memory (leaving 4GB for disk cache), but that also might NOT be enough.


2 Answers

Enable GC logging and graph the timeseries, this can tell you velocity of JVM memory allocation and how much is being collected if at all so you can approximate a high water mark.

like image 29
Jé Queue Avatar answered Sep 28 '22 04:09

Jé Queue


  1. Upgrade to the latest jdk 6 if you haven't already. I hit a similar OOME on jdk 5 that went away with 6. I suspect an nio thing.

  2. Try lowering maxPendingDeletes in your solrconfig.xml.

  3. To find out what component of solr is using up all of the memory, start solr like this:

    java -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=some_directory_of_your_choice -jar start.jar

Then parse the heap dump using the stand-alone MAT from http://www.eclipse.org/mat/ and lower the corresponding cache that is eating up all your memory.

like image 136
Alex Nauda Avatar answered Sep 28 '22 03:09

Alex Nauda