Error in production: "GC overhead limit exceeded"

时间:2019-04-08 13:55:53

标签: java garbage-collection jvm apache-karaf

I need an hint or maybe an tool,to try to get the optimization of 80.000 records. Most importantly of this issue is to try to understand an manner of simulating ,because the problem is getting in production and i dont have ,or better saying till now ,not have an specific tool for an application built in OSGI framework,Java.

More precisely if there is another way ,besides :

export JAVA_MIN_MEM=256M # Minimum memory for the JVM export JAVA_MAX_MEM=1024M # Maximum memory for the JVM export JAVA_PERM_MEM=128M # Minimum perm memory for the JVM export JAVA_MAX_PERM_MEM=256M # Maximum memory for the JVM

Below is a form of example of two calls:

curl -X POST 
http://localhost:8182/cxf/rest/ped/v1/terminals/shops 
 -H 'Content-Type: application/json' 
 -H 'Postman-Token: 743b0fdb-9df9-4751-ad8c-b0f7a4f96e87' 
 -H 'cache-control: no-cache' 
 -d '{
 "correlationId": "1cb67b93-783e-48e3-9820-bd936ca14df0",
 "terminalId": "0",
 "includeServiceDetail": "0"
'

and

curl -X POST 
http://localhost:8182/cxf/rest/ped/v1/terminals/shops 
 -H 'Content-Type: application/json' 
 -H 'Postman-Token: e29a3956-16e7-496d-af81-f5b424c41d4c' 
 -H 'cache-control: no-cache' 
 -d '{
 "correlationId": "5c62e30a-baff-469a-993f-429559979e7a",
 "includeServiceDetail": "0"
'

(its localhost ,because its in SSH).

In both cases it appears an error 500.

Below is the log,get in production:

Error:

Caused by:

org.apache.cxf.interceptor.Fault: GC overhead limit exceeded
at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:128)
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:193)
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:103) ...
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded`

Everything helps ,even an comment,of an article not read till now.

1 个答案:

答案 0 :(得分:-1)

该词的第一个Google匹配命中率很高-https://plumbr.io/outofmemoryerror/gc-overhead-limit-exceeded

本质上,您的Java服务器进程具有一定数量的内存,可以使用该内存-每次创建对象时,通过调用new ...,都会使用其中的一些内存。当Java开始运行时内存不足时,会有一个后台任务,称为垃圾回收器,它可以识别不再需要的那些对象,并释放该内存以便可以重用。您收到的特定错误消息表示垃圾收集器无法回收足够的内存以使程序继续运行。

如果您对Java服务器进程的运行方式了解得足够多,那么可以先尝试增加分配给它的内存(堆)的大小。如果您是通过命令行运行的,则需要将-Xmx参数传递给java程序,使其大小大于默认值(因此请尝试使用类似-Xmx1G的方法) )。如果您通过某个应用程序容器(例如Tomcat)运行,则需要找到配置文件,该文件包含传递给java的命令并在其中进行设置。