{"id":2515,"date":"2015-08-02T22:56:29","date_gmt":"2015-08-02T22:56:29","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=2515"},"modified":"2015-08-02T22:56:29","modified_gmt":"2015-08-02T22:56:29","slug":"fixing-cannot-allocate-memory-with-solr-5-2-1","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/fixing-cannot-allocate-memory-with-solr-5-2-1\/","title":{"rendered":"Fixing &#8220;Cannot allocate memory&#8221; with Solr 5.2.1"},"content":{"rendered":"<p>If you run Solr on a VM, it may appear to start and fail. <\/p>\n<pre lang=\"bash\">\nbin\/solr start -p 8000 -f\n<\/pre>\n<p>If you run it with &#8220;-f&#8221; (preventing backgrounding the process) you will then seen an out of memory error:<\/p>\n<pre>\nStarting Solr on port 8983 from \/root\/solr-5.2.1\/server\n\nOpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000e8000000, 402653184, 0) failed; error='Cannot allocate memory' (errno=12)\n#\n# There is insufficient memory for the Java Runtime Environment to continue.\n# Native memory allocation (mmap) failed to map 402653184 bytes for committing reserved memory.\n# An error report file with more information is saved as:\n# \/root\/solr-5.2.1\/server\/hs_err_pid16824.log\n<\/pre>\n<p>This is easily fixed by adding a memory argument (-m) &#8211; the default is 512 so if you&#8217;re hitting this error you&#8217;re likely using a cheap VM and need to lower this, or rebuild it with more RAM:<\/p>\n<pre lang=\"bash\">\nbin\/solr start -p 8000 -f -m 256m\n<\/pre>\n<p>This is what you should see:<\/p>\n<pre>\nStarting Solr on port 8000 from \/root\/solr-5.2.1\/server\n\n0    [main] INFO  org.eclipse.jetty.util.log  [   ] \u2013 Logging initialized @1403ms\n816  [main] INFO  org.eclipse.jetty.server.Server  [   ] \u2013 jetty-9.2.10.v20150310\n914  [main] WARN  org.eclipse.jetty.server.handler.RequestLogHandler  [   ] \u2013 !RequestLog\n948  [main] INFO  org.eclipse.jetty.deploy.providers.ScanningAppProvider  [   ] \u2013 Deployment monitor [file:\/root\/solr-5.2.1\/server\/contexts\/] at interval 0\n3991 [main] INFO  org.eclipse.jetty.webapp.StandardDescriptorProcessor  [   ] \u2013 NO JSP Support for \/solr, did not find org.apache.jasper.servlet.JspServlet\n4030 [main] WARN  org.eclipse.jetty.security.SecurityHandler  [   ] \u2013 ServletContext@o.e.j.w.WebAppContext@457e2f02{\/solr,file:\/root\/solr-5.2.1\/server\/solr-webapp\/webapp\/,STARTING}{\/solr.war} has uncovered http methods for path: \/\n4136 [main] INFO  org.apache.solr.servlet.SolrDispatchFilter  [   ] \u2013 SolrDispatchFilter.init()WebAppClassLoader=1582797472@5e5792a0\n4164 [main] INFO  org.apache.solr.core.SolrResourceLoader  [   ] \u2013 JNDI not configured for solr (NoInitialContextEx)\n4165 [main] INFO  org.apache.solr.core.SolrResourceLoader  [   ] \u2013 using system property solr.solr.home: \/root\/solr-5.2.1\/server\/solr\n4167 [main] INFO  org.apache.solr.core.SolrResourceLoader  [   ] \u2013 new SolrResourceLoader for directory: '\/root\/solr-5.2.1\/server\/solr\/'\n4392 [main] INFO  org.apache.solr.core.SolrXmlConfig  [   ] \u2013 Loading container configuration from \/root\/solr-5.2.1\/server\/solr\/solr.xml\n4534 [main] INFO  org.apache.solr.core.CoresLocator  [   ] \u2013 Config-defined core root directory: \/root\/solr-5.2.1\/server\/solr\n4566 [main] INFO  org.apache.solr.core.CoreContainer  [   ] \u2013 New CoreContainer 2073621255\n4567 [main] INFO  org.apache.solr.core.CoreContainer  [   ] \u2013 Loading cores into CoreContainer [instanceDir=\/root\/solr-5.2.1\/server\/solr\/]\n4567 [main] INFO  org.apache.solr.core.CoreContainer  [   ] \u2013 loading shared library: \/root\/solr-5.2.1\/server\/solr\/lib\n4568 [main] WARN  org.apache.solr.core.SolrResourceLoader  [   ] \u2013 Can't find (or read) directory to add to classloader: lib (resolved as: \/root\/solr-5.2.1\/server\/solr\/lib).\n4603 [main] INFO  org.apache.solr.handler.component.HttpShardHandlerFactory  [   ] \u2013 created with socketTimeout : 600000,connTimeout : 60000,maxConnectionsPerHost : 20,maxConnections : 10000,corePoolSize : 0,maximumPoolSize : 2147483647,maxThreadIdleTime : 5,sizeOfQueue : -1,fairnessPolicy : false,useRetries : false,\n5305 [main] INFO  org.apache.solr.update.UpdateShardHandler  [   ] \u2013 Creating UpdateShardHandler HTTP client with params: socketTimeout=600000&connTimeout=60000&retry=true\n5311 [main] INFO  org.apache.solr.logging.LogWatcher  [   ] \u2013 SLF4J impl is org.slf4j.impl.Log4jLoggerFactory\n5327 [main] INFO  org.apache.solr.logging.LogWatcher  [   ] \u2013 Registering Log Listener [Log4j (org.slf4j.impl.Log4jLoggerFactory)]\n5330 [main] INFO  org.apache.solr.core.CoreContainer  [   ] \u2013 Node Name:\n5331 [main] INFO  org.apache.solr.core.CoreContainer  [   ] \u2013 No authentication plugin used.\n5547 [main] INFO  org.apache.solr.core.CoresLocator  [   ] \u2013 Looking for core definitions underneath \/root\/solr-5.2.1\/server\/solr\n5599 [main] INFO  org.apache.solr.core.CoresLocator  [   ] \u2013 Found 0 core definitions\n5609 [main] INFO  org.apache.solr.servlet.SolrDispatchFilter  [   ] \u2013 user.dir=\/root\/solr-5.2.1\/server\n5610 [main] INFO  org.apache.solr.servlet.SolrDispatchFilter  [   ] \u2013 SolrDispatchFilter.init() done\n5651 [main] INFO  org.eclipse.jetty.server.handler.ContextHandler  [   ] \u2013 Started o.e.j.w.WebAppContext@457e2f02{\/solr,file:\/root\/solr-5.2.1\/server\/solr-webapp\/webapp\/,AVAILABLE}{\/solr.war}\n5693 [main] INFO  org.eclipse.jetty.server.ServerConnector  [   ] \u2013 Started ServerConne\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>If you run Solr on a VM, it may appear to start and fail. bin\/solr start -p 8000 -f If you run it with &#8220;-f&#8221; (preventing backgrounding the process) you will then seen an out of memory error: Starting Solr on port 8983 from \/root\/solr-5.2.1\/server OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000e8000000, 402653184, 0) failed; &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.garysieling.com\/blog\/fixing-cannot-allocate-memory-with-solr-5-2-1\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Fixing &#8220;Cannot allocate memory&#8221; with Solr 5.2.1&#8243;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[9],"tags":[104,338,517],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/2515"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=2515"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/2515\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=2515"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=2515"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=2515"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}