ARTIFACTORY: How to take thread dumps during a java.lang.OutOfMemoryError: Java heap space error

ARTIFACTORY: How to take thread dumps during a java.lang.OutOfMemoryError: Java heap space error

AuthorFullName__c
Matthew Wang
articleNumber
000006064
ft:sourceType
Salesforce
FirstPublishedDate
2024-03-28T07:53:01Z
lastModifiedDate
2025-05-21
VersionNumber
8

There may be cases where you would want to take thread dumps when there is a java.lang.OutOfMemoryError: Java heap space, as it will help with correlation with heap dumps. To do so, you can overwrite the “-XX:OnOutOfMemoryError” parameter in the extraJavaOpts in the system.yaml. This parameter is already present by default but will be overwritten when used with extraJavaOpts like below.
 

shared:
    ## Java 17 distribution to use
    #javaHome: "JFROG_HOME/artifactory/app/third-party/java"
    ## Extra Java options to pass to the JVM. These values add to or override the defaults.
    extraJavaOpts: "-Xms512m -Xmx4g -XX:OnOutOfMemoryError=\"/opt/jfrog/artifactory/app/third-party/java/bin/jcmd %p Thread.print  > /tmp/ThreadDump.txt ; kill -9 %p\""