Garbage Collection log settings for Bitbucket Server and Data Center 6+ when using Java version 11
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
Since Java 9, the garbage collection JVM arguments have changed, as the Unified JVM Logging has been introduced. Using GC arguments such as those supported in Java 8 such as:
-Xloggc:<PATH_TO_GC_LOGS>
-XX:+PrintGCDetails
-XX:+PrintGCDateStamps
-XX:+PrintGCTimeStamps
-XX:+PrintGCCause
-XX:+UseG1GC
-XX:+UseGCLogFileRotation
-XX:NumberOfGCLogFiles=5
-XX:GCLogFileSize=20M
Bitbucket will not start, as the JVM will fail with errors:
Unrecognized VM option 'UseGCLogFileRotation'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Diagnosis
Environment
AdoptOpen JDK 11
Resolution
To map old GC flags to the new ones you can reference 43 GC logging flags removed from Java 9. The following Java flags are no longer supported in Java 9 and upwards, as the Unified JVM Logging has been introduced:
-Xloggc:<PATH_TO_GC_LOGS>
-XX:+PrintGCDetails
-XX:+PrintGCDateStamps
-XX:+PrintGCTimeStamps
-XX:+PrintGCCause
-XX:+UseGCLogFileRotation
-XX:NumberOfGCLogFiles=5
-XX:GCLogFileSize=20M
Please ensure you append the following entry to continue logging the Garbage Collection (GC) activity. This should be added to the <Bitbucket-installation-directory>/bin/_start-webapp.sh
. The entry should be assigned as a value for the JVM_SUPPORT_RECOMMENDED_ARGS
parameter:
JVM_SUPPORT_RECOMMENDED_ARGS="-Xlog:gc*:file=$BITBUCKET_HOME/log/gc-%t.log:tags,time,uptime,level:filecount=10,filesize=5M"
If you existing value assigned for JVM_SUPPORT_RECOMMENDED_ARGS
, please append the values.