ARTIFACTORY: Cleanup Policy Fails to Execute When Garbage Collection Is Running Concurrently

Products
Frog_Artifactory
Content Type
Use_Case
AuthorFullName__c
Harish Gowda
articleNumber
000006903
FirstPublishedDate
2026-04-13T06:31:10Z
lastModifiedDate
2026-04-13

ARTIFACTORY: Cleanup Policy Fails to Execute When Garbage Collection Is Running Concurrently

Introduction 
In certain scenarios, a Cleanup Policy may fail to execute if the Garbage Collection (GC) task is running at the same time. The system prevents the Cleanup Policy from starting because GC is considered a mandatory task that cannot be interrupted.

This behavior is reflected in error messages such as:
PackageCleanupJob cannot stop a mandatory related job BinaryStoreGarbageCollectorJob while it's running
Cannot execute the '<repository-name>' cleanup policy at this time due to an ongoing mandatory task (For example, Garbage Collection). Please try again later.
This issue is documented in internal Jira ticket RTDEV-50751, which describes cases where a Cleanup Policy fails due to an active GC process.


Resolution

An enhancement introduced under internal Jira RTDEV-57374 allows Cleanup Policies to run concurrently with Garbage Collection when the health-aware job feature is enabled.

This fix is available starting in Artifactory version 7.124.0 and can be enabled via the system property.
artifactory.retention.system.health.aware.job.enabled=true

How the Enhancement Works:
When enabled, the system monitors overall resource utilization (CPU and thread usage) and classifies system health into the following states:

HEALTHY – Less than 80% thread usage

LOADED

OVERLOADED

OUTAGE

Cleanup Policies are allowed to run only when the system state is HEALTHY.
If the system exceeds the defined threshold (for example, due to GC resource consumption), the policy execution is deferred and a clear warning is logged.

This mechanism protects system stability while allowing more flexible scheduling between Cleanup Policies and Garbage Collection. 

Configuration Steps:
Step 1: Log in to the server hosting Artifactory.

Step 2: Navigate to:
$JFROG_HOME/artifactory/var/etc/artifactory/artifactory.system.properties
Step 3: Add the following line at the end of the file:
artifactory.retention.system.health.aware.job.enabled=true
Step 4: Save the file.
Step 5: Restart the Artifactory service to apply the changes.


Conclusion

The Cleanup Policy failure occurs because the system prevents mandatory tasks, such as Garbage Collection, from being interrupted.

By enabling the health-aware job feature, Cleanup Policies and Garbage Collection can run concurrently when system resources permit. This enhancement ensures improved scheduling flexibility while maintaining system performance and stability.