Tomcat崩溃,错误java.lang.OutOfMemoryError:超出GC开销限制 [英] Tomcat crashes with error java.lang.OutOfMemoryError: GC overhead limit exceeded

查看:686
本文介绍了Tomcat崩溃,错误java.lang.OutOfMemoryError:超出GC开销限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在tomcat运行了好几个月后,我无意中发现了下面的错误。
我们重新启动了tomcat,错误现在没有出现,但可能会在未来再次出现。
我看到其他用户有类似的异常,与垃圾收集有关,但与NIO连接器无关。



有人知道为什么会这样发生,应该是正确的修复,以避免它。

  2016年1月15日上午7点46分47秒org.apache。 tomcat.util.net.NioEndpoint $ SocketProcessor运行
SEVERE:
java.lang.OutOfMemoryError:在java.util.Collections.synchronizedSet处超过
的GC开销限制(Collections.java:1691)
at org.atmosphere.cpr.AtmosphereRequest $ Builder。< init>(AtmosphereRequest.java:1146)
at org.atmosphere.cpr.AtmosphereRequest.wrap(AtmosphereRequest.java:1891)
在org.atmosphere.cpr.AtmosphereServlet.event(AtmosphereServlet.java:295)
在org.apache.catalina.core.ApplicationFilterChain.internalDoFilterEvent(ApplicationFilterChain.java:484)
在org.apache.catalina .core.ApplicationFilterChain.doFilterEvent(ApplicationFilte rChain.java:377)在org.apache.catalina.core.StandardWrapperValve.event(StandardWrapperValve.java:411

在org.apache.catalina.core.StandardContextValve.event(StandardContextValve.java:
at org.apache.catalina.valves.ValveBase.event(ValveBase.java:224)
at org.apache.catalina.core.StandardHostValve.event(StandardHostValve.java:256)
at org.apache.catalina.valves.ValveBase.event(ValveBase.java:224)
at org.apache.catalina.valves.ValveBase.event(ValveBase.java:224)
at org .apache.catalina.core.StandardEngineValve.event(StandardEngineValve.java:138)
在org.apache.catalina.connector.CoyoteAdapter.event(CoyoteAdapter.java:210)
在org.apache.coyote .http11.Http11NioProcessor.event(Http11NioProcessor.java:124)
在org.apache.coyote.AbstractProtocol $ AbstractConnectionHandler.process(AbstractProtocol.java:585)
在org.apache.tomcat.util.net .NioEndpoint $插座Processor.run(NioEndpoint.java:1690)
在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
在java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(的ThreadPoolExecutor。 java:615)
at java.lang.Thread.run(Thread.java:744)


解决方案

您的服务器没有足够的内存来管理某些特别耗费内存的任务,或者您有内存泄漏。


  1. 对于第一种情况,您可能需要使用 -Xmx -Xms VM参数,请参阅 Java VM选项 b
    本主题显示 Tomcat 增加Tomcat内存设置


    1. 对于第二种情况,您应该创建堆转储,其中 jmap

    2. >

      堆转储文件表示java进程的当前堆分配。 > jmap -dump:file =< file-name> <步骤-ID>

      这里,< file-name> 是您要创建的文件,< process-id> 是Tomcat进程的标识。



      Eclipse MAT 这样的工具可以打开并分析堆转储文件,按类别告诉你的对象数量,按对象类型占用内存,怀疑内存泄漏等等......


      After the tomcat ran several months, I got unexpectetly the error below. We restarted the tomcat and the error do not appear now but may be will come again in the future. I saw that another users had simmilar exceptions, related with the garbage collection, but not related exactly with the NIO connector.

      Does somebody has an idea why this happens and what should be the correct fix to avoid it.

      Jan 15, 2016 7:46:47 AM org.apache.tomcat.util.net.NioEndpoint$SocketProcessor run
      SEVERE: 
      java.lang.OutOfMemoryError: GC overhead limit exceeded
              at java.util.Collections.synchronizedSet(Collections.java:1691)
              at org.atmosphere.cpr.AtmosphereRequest$Builder.<init>(AtmosphereRequest.java:1146)
              at org.atmosphere.cpr.AtmosphereRequest.wrap(AtmosphereRequest.java:1891)
              at org.atmosphere.cpr.AtmosphereServlet.event(AtmosphereServlet.java:295)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilterEvent(ApplicationFilterChain.java:484)
              at org.apache.catalina.core.ApplicationFilterChain.doFilterEvent(ApplicationFilterChain.java:377)
              at org.apache.catalina.core.StandardWrapperValve.event(StandardWrapperValve.java:411)
              at org.apache.catalina.core.StandardContextValve.event(StandardContextValve.java:146)
              at org.apache.catalina.valves.ValveBase.event(ValveBase.java:224)
              at org.apache.catalina.core.StandardHostValve.event(StandardHostValve.java:256)
              at org.apache.catalina.valves.ValveBase.event(ValveBase.java:224)
              at org.apache.catalina.valves.ValveBase.event(ValveBase.java:224)
              at org.apache.catalina.core.StandardEngineValve.event(StandardEngineValve.java:138)
              at org.apache.catalina.connector.CoyoteAdapter.event(CoyoteAdapter.java:210)
              at org.apache.coyote.http11.Http11NioProcessor.event(Http11NioProcessor.java:124)
              at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
              at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1690)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
              at java.lang.Thread.run(Thread.java:744)
      

      解决方案

      Either your server didn't have enough memory to manage some particularly memory-consuming task, or you have a memory leak.

      1. For the first case, you may want to change memory settings of tomcat with -Xmx and -Xms VM arguments, see Java VM options .

      This topic shows a full example for Tomcat : Increase Tomcat memory settings

      1. For the second case, you should create a heap dump, with jmap for instance.

      A heap dump file represents the current heap allocation of a java process.

      jmap -dump:file=<file-name> <process-id>
      

      Here, <file-name> is the file you want to create, and <process-id> is the id of the Tomcat process.

      Some tools like Eclipse MAT , can open and analyze a heap dump file, tell you the number of objects by class, occupied memory by object types, memory leak suspects, and so on...

      这篇关于Tomcat崩溃,错误java.lang.OutOfMemoryError:超出GC开销限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆