[Unloading class sun.reflect.GeneratedMethodAccessor] found in Tomcat logs while experiencing performance issues

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

The instance will have become unstable and will either have frozen or crashed and usually requires to be restarted.

Error messages similar to the following will populate the catalina.out log file, often flooding large sections of it:

[Unloading class sun.reflect.GeneratedMethodAccessor1356]
[Unloading class sun.reflect.GeneratedMethodAccessor2866]
[Unloading class sun.reflect.GeneratedMethodAccessor2706]
[Unloading class sun.reflect.GeneratedMethodAccessor1150]
[Unloading class sun.reflect.GeneratedMethodAccessor4528]
[Unloading class sun.reflect.GeneratedMethodAccessor5153]
[Unloading class sun.reflect.GeneratedMethodAccessor2913]
[Unloading class sun.reflect.GeneratedMethodAccessor916]

Diagnosis

If you see these errors in your Tomcat logs and you have NOT added both of the following JVM arguments to your startup options then you are experiencing this problem.

-XX:+CMSClassUnloadingEnabled
-XX:-UseConcMarkSweepGC

Cause

This type of issue occurs when the JVM finds it physically does not have the resources that have been allocated to it, (usually due to either VM ballooning or resource stealing), at which point the JVM will panic and start unloading classes from the PermGen memory in order to place the object in memory that it still controls. If it achieves this and its resources are released by the entity stealing them, the application will appear to return to normal, but usually it is unable to do this and the application will crash with no logging as to what occurred.

Resolution

The only way to stop this from happening is to prevent the ballooning/stealing from occurring, some suggestions to do this can be found below:

  • Allocate more resources to your server.
  • Reduce the load on the server from other applications.
  • Isolate the server better so that it doesn't get its resources stolen in the first place.

Last modified on Apr 11, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.