What is the difference in java.lang.OutOfMemory: G

2019-07-03 15:08发布

问题:

I am investigating the slowness in our application and eventually one of the instances in a cluster environment going down. Few weeks back I came across the error below:

[#|2012-05-11T14:12:03.460-0400|SEVERE|sun-appserver2.1|javax.enterprise.system.container.web|_ThreadID=89;_ThreadName=httpSSLWorkerThread-7311-0;_RequestID=7afaee11-c970-40dd-b5fb-29498af8e512;|StandardWrapperValve[LoginModule]: PWC1406: Servlet.service() for servlet LoginModule threw exception
java.lang.OutOfMemoryError: GC overhead limit exceeded

I figured that since GC overhead limit was exceeding, it had something to do with my application. There is a report that is really intensive on putting records in excel using POI, so I thought that might be causing it. As a short term fix, until next release, we informed 1 user who had access to this report to not access it.

However, today, two weeks later again one of the instances went down and upon searching the logs I found the error below:

[#|2012-06-05T10:31:36.532-0400|SEVERE|sun-appserver2.1|net.jxta.impl.endpoint.mcast.McastTransport|_ThreadID=141;_ThreadName=IP Multicast Listener for mcast://228.8.10.93:31676;_RequestID=90caf76e-b740-4f11-8ffe-8ab88a740569;|Uncaught Throwable in thread :IP Multicast Listener for mcast://228.8.10.93:31676
java.lang.OutOfMemoryError: Java heap space
|#]

Please note the difference in GC overhead limit exceeded vs. Java heap space. I am trying to find out whether the error I saw today is caused by the same reason of the user accessing the report, however, I believe if that were the case then I would see GC overhead limit exceeded.

I believe the error today is more related to the configuration of the server.

please help in clarifying.

回答1:

The first error "GC Overhead" means that GC is taking large portion of CPU cycle, mostly it means 98% or 99% and in each run it is releasing very less memory 1-2%.

The second error means your application went out of memory during some processing.

Also your investigation is correct of POI using up too much of memory, POI has a history of extra memory consumption.

Came across a very good discussion on SO



回答2:

There is a good discussion on a similar topic here. It is basically caused when a lot of time is consumed by GC but very little memory is recovered.