Reputation: 91
My SpringBoot app have a problem with java.lang.OutOfMemoryError: GC overhead limit exceeded
.
I can see log as below:
Handler dispatch failed; nested exception is java.lang.OutOfMemoryError: GC overhead limit exceeded.
Additionally, cpu is very high when I working in the application(99%). I think that it is conected with XMX. So how can I check the xmx size set for this application? Or is the problem in something else? Thanks in advance!
Upvotes: 0
Views: 13307
Reputation: 718906
My SpringBoot app have a problem with
java.lang.OutOfMemoryError: GC overhead limit exceeded
.I can see log as below:
Handler dispatch failed; nested exception is java.lang.OutOfMemoryError: GC overhead limit exceeded.
That is a common error.
It means that your application's JVM is spending too much time running the garbage collector. It typically happens because you have nearly run out of space, and the GC is having to run more and more often to keep going.
Additionally, cpu is very high when I working in the application(99%).
That is to be expected; see above.
I think that it is connected with xmx.
Yes it is connected with that.
One possibility is that the task your webapp is doing needs needs more memory than is allowed by the -xmx
setting. Increasing -xmx
will solve the problem ... until you get to a larger task. At that point you need to see if you can optimize memory usage, or buy a machine with more memory. (How much money do you have in the bank?)
Another possibility is that your webapp has a memory leak. If that is the problem then increasing -xmx
doesn't solve the problem. Your webapp is liable to run into OOME's again ... though it may take longer for it to happen.
I suggest that you find and read a good article on fixing memory leaks. Assume that it is a leak ... until you find clear evidence that it is not.
So how can I check the xmx size set for this application?
It depends on how you are running the springboot application. For example, this article explains how to do it with an embedded Tomcat.
Upvotes: 1