Jira Temporary Directory Cleaner
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. 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
Summary
With Jira Data Center release 9.5, we’re introducing a feature to solve the issue of instances running out of space: Jira Temporary Directory Cleaner.
Learn more in the following ticket: - JRASERVER-46006Getting issue details... STATUS
Environment
Jira Data Center on any version from 9.5.0.
What does this feature do?
Jira will automatically clean its temporary directory during startup.
How to enable the feature?
In Jira 9.5, the feature is disabled by default. We're planning to enable it in the first half of 2023.
To enable the automatic Temporary Directory Cleaner set the tmpdir.clean.on.startup
property to true
. You can do this by adding a new argument in the setenv.sh
script:-Dtmpdir.clean.on.startup=true
.
Change starting from Jira version 9.11.0
From Jira version 9.11.0 onwards, if you need to disable the temporary directory cleanup, you need to set the tmpdir.clean.on.startup.disabled
property to true
.
How does it work?
Jira will clean the directory defined by the java.io.tmpdir
property upon Jira startup. This only happens on start up since while Jira is running those temp files may be in use. Deleting these temporary files while Jira is in normal use could cause data loss or system instability, therefore this can only be done upon start before Jira is in normal use.
Due to safety reasons, Jira will attempt to remove files from this directory only when the temporary directory is a subdirectory of one of the following:
Jira Home
Catalina Base (defined by the
catalina.base
property)Catalina Home (defined by the
catalina.home
property)
The feature impacts Jira Service Management if the Jira temporary directory defined by the java.io.tmpdir
property stores temporary files.
New classes that debug logging can be enabled for
All logs in this feature come from com.atlassian.jira.startup.TemporaryDirectoryCleaner
.
Log | Description |
---|---|
INFO "The temporary directory cleaner is disabled. It can be enabled by setting the system property 'tmpdir.clean.on.startup' to true" | The Cleaner is turned off. |
INFO "Cleaning the temporary directory located at {}" | The Cleaner is about to start removing temporary files. |
INFO "Finished cleaning the temporary directory." | The Cleaner has finished removing temporary files. |
WARNING "Finished cleaning the temporary directory, but couldn't remove the following files:\n{}" | Some files couldn’t be removed. In this case, the paths of these files will be logged into the log file. But no more than 20 paths will be logged. If there are more, the message about that will appear. |
WARNING ”The temporary directory [{}] does not exist. Skipping cleaning.” | The Cleaner is enabled but the temporary directory doesn’t exist. This won’t cause the Cleaner to fail but won’t remove any files. |
WARNING "The temporary directory [{}] should be located in the Jira Home directory [{}] or in one of directories defined by '{}' or '{}' properties. Skipping cleaning." | The feature is enabled but the temporary directory isn’t located in To fix this, change the location of the temporary directory. To find it, check |
ERROR "Failed to clean the temporary directory located at {}" | There was an exception during the cleaning. The stacktrace will be logged. |