Profile Image
Lorenzo Cavalieri

Help an Italian boy struggling with the Garbage Collector

Hello Crash community,
I introduce myself, I'm Lorenzo Cavalieri a Junior Developer for a small Italian software house, before asking you my question I explain the problem so that someone within your community can help me;


So what's going on?
Our company has a Unix machine with a tomcat server inside, I, the programmer, create the .war to be fed to the Tomcat to make it work;
What happens? It happens that if initially in the machine there were only 5 wars divided into WebApp and Rest-Api with Job Scheduled some via Spring-boot Scheduled others via Quartz, it happened that for work reasons the 17 wars increased from 5 wars always divided between WebApp and Rest-Api with Job Scheduled as written above... It happens that on average every 3 days the tomcat server crashes and no longer works, analyzing the logs the reason why it crashes and no longer works is due to this "GC overhead limit exceeded" error. to see the "Full thread dump Java HotSpot(TM) 64-Bit Server VM" that tomcat gives me every time I restart it, through internet searches and the baeldung website I found your site, uploaded the copied raw file and glued eeeeeee.....

I didn't understand shit -> I didn't understand anything


So I mostly ask…

1) is it possible to understand why this car crashes through this file?
2) how can I read this page and maybe be able to understand the error?
3) is the correct method or am I doing it wrong? 4) What are the recommendations to better analyze and understand the "GC overhead limit exceeded" error

 

In the period from 02/17/2023 to 02/26/2023 the "GC overhead limit exceeded" error appeared 4 times and as a result I have 4 "Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.202-b08 mixed mode)" I hope it will be useful for you

1 Report URL - https://fastthread.io/my-thread-report.jsp?p=c2hhcmVkLzIwMjMvMDMvMi81M2I5ZDI2Zi02ZTE5LTQzZjItOWI1MC03OWIwMWU5NzIyNjMudHh0LS0xNS0wLTE2&

2 Report URL - https://fastthread.io/my-thread-report.jsp?p=c2hhcmVkLzIwMjMvMDMvMi83NzM4MmE2NC0yNWU3LTQ5NTktOTUzYi00YTk5NmVjYWFiNzUudHh0LS0xNC00NC0xMA==

3 Report URL - https://fastthread.io/my-thread-report.jsp?p=c2hhcmVkLzIwMjMvMDMvMi83MGE0ZmQ1My0wMjBhLTRlMzMtOTRlMS1hOGZhOGIzMGY1ZjEudHh0LS0xNS0zLTM0&

4 Report URL -  https://fastthread.io/my-thread-report.jsp?p=c2hhcmVkLzIwMjMvMDMvMi83MDZmOGQ3ZC1lZTI2LTRkZTctOTliNi0yM2MyZDAzZGI2ZGYudHh0LS0xNS00LTI1&

  • gcerror

  • thread

  • Unix machine

  • tomcat server

  • Spring-boot

  • Quartz

  • WebApp

  • Rest-Api

  • car crashes

  • GC overhead limit exceeded

  • outofmemoryerror

  • memory leak

  • JDBC Connections

Please Sign In or to post your comment or answer

Profile Image

Ram Lakshmanan

Hello Lorenzo!

 

 Warm welcome to the Italian boy from the beautiful wine & dine country!!

 

 In order to diagnose 'OutOfMemoryError: GC overhead limit exceeded' - we need to study the Garbage Collection log file first and not thread dump. Thread dump might not be helpful in this case.

 

 When your application experiences 'OutOfMemoryError: GC overhead limit exceeded' it means you are having either one of the problem:

 

a. Your application needs more memory than what you have allocated

b. Your application has memory leak. 

 

Let's discuss them below:

 

a. Your application needs more memory than what you have allocated:

Is this 'OutOfMemoryError: GC overhead limit exceeded' happening during peak volume time period? Or are you running Batch processes around this time? May be your application traffic volume has grown. More traffic translates to more memory consumption. Thus you might need to allocate more memory to your application than what you have allocated. Try increasing your -Xmx and see whether this problem goes away.

 

b. Your application has memory leak

 

If your application has memory leak then also this problem can surface. Did you make any recent code deployment? Did the 

'OutOfMemoryError: GC overhead limit exceeded' started surfacing after that? Here is a video clip that walks you through how to diagnose memory leak: https://www.youtube.com/watch?v=SuguH8YBl5g&t=21s

 

I would first try #a (i.e. increase memory) and see whether this problem goes away. I would also highly recommend you to read this memory pattern blog post.

Profile Image

Lorenzo Cavalieri

Hello Ram, thank you so much for your really kind reply all our development team thanks you;

 

I start by saying that in my ignorance, no, I haven't read and I can't find the garbage collector file I don't know where it is and what it's called we will also try to increase the -Xmx and in the meantime we will see if this problem is solved, moreover I would like to know where to find these logs and, if necessary, upload them online and show them to you

Profile Image

Ram Lakshmanan

Hello Lorenzo! Here is a blog post which walks you through how to generate GC log file. Once it's generated upload it to GCeasy and share the report URL, just like how did it in fastThread

Profile Image

Lorenzo Cavalieri

Thank you, first of all I would like to know some things:
1) According to my bosses, the cause of the "OutOfMemoryError: GC overhead limit exceeded" is due to the fact that our wars open many JDBC Connections and do not close them when making queries to the Database
Could this be the mistake you think? Or is this error caused by another problem?

 

2) I have seen the two ways you told me now let's talk well with whoever configures the tomcat servers and so we enable the possibility of making the GC log (currently not available) then over time I will load the analysis and at the most I will open a new post in this community

 

For the rest thanks, thanks again for all the help and now we start studying

Profile Image

Ram Lakshmanan

1. Not closing JDBC connections can also cause 

"OutOfMemoryError: GC overhead limit exceeded". This falls under the option #b. Your application has memory leak - that I mentioned above.

 

2. Lorenzo - besides GC logs, capturing 360-degree will also be helpful. You may use this open source script which captures 16 artifacts from your application stack. One of the artifact it captures is netstat, which will report network connection stats as well. So in case if JDBC connections are not getting closed, network connection count to that Database would be very high.

 

Once you have the data, let me know. we can look at it.

Profile Image

Lorenzo Cavalieri

thank you very much, for anything I will let you know

Grazie Mille, Gentilissimi;

Got something else on mind? Post Your Question

Not the answer you're looking for? Browse other questions tagged
  • gcerror

  • thread

  • Unix machine

  • tomcat server

  • Spring-boot

  • Quartz

  • WebApp

  • Rest-Api

  • car crashes

  • GC overhead limit exceeded

  • outofmemoryerror

  • memory leak

  • JDBC Connections