How to fix java.lang.OutOfMemoryError: PermGen space in solr?
How to fix java.lang.OutOfMemoryError: PermGen space in solr?
我们的生产服务器时不时会遇到这个错误。当我们重新启动 solr 时,这个问题就解决了。
但是几天后又出现了。
版本信息:
我们同时使用 centos6 和 centos7 机器,Centos6 使用 java7 而 centos7 使用 java8.
solr: 5.5.5
at org.apache.solr.servlet.HttpSolrCall.sendError(HttpSolrCall.java:607)
at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:475)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:257)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:208)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:499)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
at org.eclipse.jetty.io.AbstractConnection.run(AbstractConnection.java:540)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at org.eclipse.jetty.util.thread.QueuedThreadPool.run(QueuedThreadPool.java:555)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.OutOfMemoryError: PermGen space```
此信息位于 WIKI 中:https://cwiki.apache.org/confluence/display/solr/Taking+Solr+to+Production#TakingSolrtoProduction-MemoryandGCSettings
SOLR_JAVA_MEM="-Xms10g -Xmx10g"
这要么是您的 Java 应用程序内存泄漏,要么您的应用程序有时需要比允许分配或能够分配的内存更多的内存。
java.lang.OutOfMemoryError:PermGen 正是这样说的。
读这个:https://www.javainuse.com/java/permgen
简而言之:Permgen 是 Java 虚拟机的一部分(内存区域),垃圾收集不是完全自动化的。
您的本地系统管理员应该能够处理内存不足错误。
无论如何给你一些建议:
- Java7和Java8有32位和64位版本,请尝试使用64位版本。
- 检查您的 Java 虚拟机的内存使用情况。
- 还要检查同一台机器上其他应用程序 运行 的内存使用情况。
如果你的Java虚拟机随着时间的推移需要越来越多的内存,直到它崩溃,因为它内存不足,这可能是程序错误,必须由程序员修复。
如果您的 Java 虚拟机的内存使用量变化很大,有时内存使用量出现高峰,这会导致内存不足错误,只需在您的机器中安装更多内存即可。
编辑:Abhijit Bashetti 的回答看起来很好,先试试这个:)
我们的生产服务器时不时会遇到这个错误。当我们重新启动 solr 时,这个问题就解决了。 但是几天后又出现了。
版本信息:
我们同时使用 centos6 和 centos7 机器,Centos6 使用 java7 而 centos7 使用 java8.
solr: 5.5.5
at org.apache.solr.servlet.HttpSolrCall.sendError(HttpSolrCall.java:607)
at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:475)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:257)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:208)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:499)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
at org.eclipse.jetty.io.AbstractConnection.run(AbstractConnection.java:540)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at org.eclipse.jetty.util.thread.QueuedThreadPool.run(QueuedThreadPool.java:555)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.OutOfMemoryError: PermGen space```
此信息位于 WIKI 中:https://cwiki.apache.org/confluence/display/solr/Taking+Solr+to+Production#TakingSolrtoProduction-MemoryandGCSettings
SOLR_JAVA_MEM="-Xms10g -Xmx10g"
这要么是您的 Java 应用程序内存泄漏,要么您的应用程序有时需要比允许分配或能够分配的内存更多的内存。
java.lang.OutOfMemoryError:PermGen 正是这样说的。
读这个:https://www.javainuse.com/java/permgen
简而言之:Permgen 是 Java 虚拟机的一部分(内存区域),垃圾收集不是完全自动化的。
您的本地系统管理员应该能够处理内存不足错误。
无论如何给你一些建议:
- Java7和Java8有32位和64位版本,请尝试使用64位版本。
- 检查您的 Java 虚拟机的内存使用情况。
- 还要检查同一台机器上其他应用程序 运行 的内存使用情况。
如果你的Java虚拟机随着时间的推移需要越来越多的内存,直到它崩溃,因为它内存不足,这可能是程序错误,必须由程序员修复。
如果您的 Java 虚拟机的内存使用量变化很大,有时内存使用量出现高峰,这会导致内存不足错误,只需在您的机器中安装更多内存即可。
编辑:Abhijit Bashetti 的回答看起来很好,先试试这个:)