java.lang.Runtime.gc detected

Issue

Slow requests files from a Support Bundle or full thread dump files show more than 1 explicit GC
call every 5 seconds.

The thread stack is similar to:

RequestHandlerThread[#191]" Id=277 RUNNABLE (in native)
	at java.lang.Runtime.gc(Native Method)

Frequent java.lang.Runtime.gc occurring more than once every 5 seconds

If you are experiencing a performance issue and the files noted above confirm frequent java.lang.Runtime.gc calls
you can set the Java parameter: -XX:+DisableExplicitGC. This will prevent the JVM from performing
the java.lang.Runtime.gc calls. Please note that you will need to restart Jenkins to have the new parameter
picked up by the JVM. The following link documents How to add Java arguments to Jenkins. If your Jenkins
environment is not configured with all of the recommended GC settings in Prepare Jenkins For Support
then the cause ofthe java.lang.Runtime.gc calls are very likely due to some code/script
that includes explicit System.gc() calls.

Please note that if you have configured your Jenkins instance with all of the recommended GC settings listed in
Prepare Jenkins For Support there is a strong possibility that one or more of the files in the JENKINS_HOME
directory no longer belongs to the user that owns the Jenkins process (Jenkins user by default).
Thus, enabling -XX:+DisableExplicitGC should resolve the issue while additional inquiries are made to confirm
this and restore the proper ownership of the files. Once the proper ownership of the files have been restored
you can remove -XX:+DisableExplicitGC.

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.