ARTIFACTORY: What is $JFROG_HOME/data/filestore/_pre folder in Artifactory, and how can it impact Artifactory's performance

AuthorFullName__c
Pranav Hegde
articleNumber
000006238
FirstPublishedDate
2024-11-18T10:36:44Z
lastModifiedDate
2025-07-22

ARTIFACTORY: What is $JFROG_HOME/data/filestore/_pre folder in Artifactory, and how can it impact Artifactory's performance

Introduction

The /opt/jfrog/artifactory/var/data/filestore/_pre folder in Artifactory is a temporary storage location used for handling files whose checksums have not yet been calculated. Understanding the role of this folder and its potential impact on Artifactory's performance is essential for administrators looking to maintain system health and optimize storage usage.


What is the Purpose of the _pre Folder?

When a file is uploaded to Artifactory, its checksum (SHA1, SHA2, or MD5) must be calculated to ensure the integrity of the file. The _pre folder temporarily stores files awaiting checksum calculation. Here is how the process works:
  1. Temporary Storage: When a file is uploaded to Artifactory, it is first placed in the _pre folder.
  2. Checksum Calculation: Artifactory calculates the file’s checksum and then attempts to move it to its final location in the repository storage.
  3. Move to Final Location: Once the checksum calculation is complete, Artifactory moves the file to its appropriate filestore provider.
  4. Error Handling: If there is an error (e.g., checksum mismatch or failure to move the file to its final location), the file is called orphaned in _pre folder.

In some cases, such as during a server shutdown or if a failure occurs (e.g., OutOfMemory (OOM) errors, connection issues, or disk space problems), files may remain in the _pre folder. These files, if not successfully processed, can become orphaned.

 

What Are Orphaned Files?

Orphaned files are those that remain in the _pre folder because Artifactory was unable to move them to their final location. This may happen due to:
  • Server Shutdowns: If Artifactory is shut down during the checksum calculation or file move process, the file may remain in the _pre folder.
  • System Failures: Failures such as OOM errors, disk full conditions, or network issues may prevent files from being processed.

In such cases, the files will not be deleted, and they will remain in the _pre folder, potentially consuming disk space.

How to Manage and Troubleshoot Orphaned Files in the _pre Folder:

If orphaned files are found in the _pre folder, they can typically be deleted safely when Artifactory is down. Here’s how to manage this situation:

  1. Check for Orphaned Files: During downtime or after an Artifactory restart, you can check the _pre folder for files that have been there for an extended period. These are likely to be orphaned.
  2. Safe Deletion: You can delete orphaned files while Artifactory is offline. This helps to free up space and avoid unnecessary storage use.
  3. Search for Stuck Files: Files stuck in the _pre folder and not processed within a reasonable timeframe may indicate underlying issues (such as resource shortages or corruption). Collect thread dumps to identify threads that have not moved from _pre in a long time.

 

_pre Folder in the Eventual and Cache Directories:

The _pre folder can be found in both the eventual and cache directories. Despite having the same naming convention for temporary files (prefixed with dbrecord and suffixed with .bin), the content in each folder is different:

  • Eventual Storage: Used for eventual consistency in Artifactory's distributed or clustered environment, where files are replicated or eventually moved to their final destination.
  • Cache Storage: Acts as a local cache for files that are retrieved frequently. The files in the cache may be temporarily stored here while checksums are calculated.

It is important to note that the contents of these two folders, while similar in naming, are not related and serve different purposes.

Troubleshooting Performance Issues Related to the _pre Folder:

If files are stuck in the _pre folder or Artifactory is experiencing performance degradation, there could be issues related to file processing, including file checksum calculations, disk space, or system resources. To troubleshoot:

1. Check for Thread Deadlocks or Resource Starvation: 

Thread dumps can help identify issues related to file processing in Artifactory. In some cases, Artifactory threads may be stuck waiting for resources, like I/O or locks, preventing files from being processed.


Example stack trace for troubleshooting: In this example, threads are waiting for resources (likely file I/O) and are stuck, which may indicate a bottleneck caused by insufficient resources, such as disk I/O or memory.

http-nio-12000-exec-3439
PRIORITY : 5
THREAD ID : 0X00007F7A08639800
NATIVE ID : 0X26216
NATIVE ID (DECIMAL) : 156182
STATE : WAITING
stackTrace:
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(java.base@11.0.13/Native Method)
- waiting on
at java.lang.Object.wait(java.base@11.0.13/Object.java:328)
at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1319)
- waiting to re-lock in wait() <0x00000007b839de00> (a java.util.concurrent.Semaphore)
at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1218)
at org.apache.coyote.http11.Http11InputBuffer.fill(Http11InputBuffer.java:805)
at org.apache.coyote.http11.Http11InputBuffer.access$400(Http11InputBuffer.java:42)
at org.apache.coyote.http11.Http11InputBuffer$SocketInputBuffer.doRead(Http11InputBuffer.java:1185)
at org.apache.coyote.http11.filters.IdentityInputFilter.doRead(IdentityInputFilter.java:101)
at org.apache.coyote.http11.Http11InputBuffer.doRead(Http11InputBuffer.java:249)
at org.apache.coyote.Request.doRead(Request.java:640)
at org.apache.catalina.connector.InputBuffer.realReadBytes(InputBuffer.java:316)
at org.apache.catalina.connector.InputBuffer.checkByteBufferEof(InputBuffer.java:599)
at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:339)
at org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:132)
at org.apache.commons.io.input.ProxyInputStream.read(ProxyInputStream.java:102)
at java.io.BufferedInputStream.read1(java.base@11.0.13/BufferedInputStream.java:290)
at java.io.BufferedInputStream.read(java.base@11.0.13/BufferedInputStream.java:351)
- locked <0x00000007b50ab378> (a org.jfrog.storage.binstore.common.Sha1Sha2Md5ChecksumInputStream)
at org.jfrog.storage.binstore.common.Sha1Sha2Md5ChecksumInputStream.read(Sha1Sha2Md5ChecksumInputStream.java:134)
at org.jfrog.storage.binstore.common.Sha1Sha2Md5ChecksumInputStream.read(Sha1Sha2Md5ChecksumInputStream.java:118)
at org.jfrog.storage.binstore.ifc.ClientStream.read(ClientStream.java:34)
at org.jfrog.storage.binstore.providers.SavedToFileInputStream.read(SavedToFileInputStream.java:75)
at org.jfrog.storage.binstore.ifc.ClientStream.read(ClientStream.java:34)
at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1158)
at org.apache.commons.io.IOUtils.copy(IOUtils.java:878)
at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1135)
at org.apache.commons.io.IOUtils.copy(IOUtils.java:854)
at org.apache.commons.io.FileUtils.copyToFile(FileUtils.java:1086)
at org.apache.commons.io.FileUtils.copyInputStreamToFile(FileUtils.java:992)
at org.jfrog.storage.binstore.providers.tools.FilePersistenceHelper.saveStreamToTempFile(FilePersistenceHelper.java:55)
at org.artifactory.addon.filestore.eventual.cluster.EventualStorage.addStream(EventualStorage.java:156)
at org.artifactory.addon.filestore.eventual.cluster.EventualClusterBinaryProvider.addStream(EventualClusterBinaryProvider.java:175)
at org.artifactory.addon.filestore.multiple.ShardingBinaryProviderImpl.addStream(ShardingBinaryProviderImpl.java:271)
at org.jfrog.storage.binstore.providers.FileCacheBinaryProviderImpl.addStream(FileCacheBinaryProviderImpl.java:173)
at org.artifactory.addon.federated.binary.FederatedBinaryProvider.addStream(FederatedBinaryProvider.java:265)
at org.artifactory.storage.db.binstore.service.BinaryServiceImpl.addBinary(BinaryServiceImpl.java:448)
.
.
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
at com.sun.proxy.$Proxy406.addBinary(Unknown Source)
at org.artifactory.repo.service.RepositoryServiceImpl.saveResource(RepositoryServiceImpl.java:2419)
at jdk.internal.reflect.GeneratedMethodAccessor807.invoke(Unknown Source)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base@11.0.13/DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(java.base@11.0.13/Method.java:566)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
at com.sun.proxy.$Proxy352.saveResource(Unknown Source)
at org.artifactory.engine.UploadServiceImpl.uploadItemWithContent(UploadServiceImpl.java:660)
at org.artifactory.engine.UploadServiceImpl.uploadItemWithProvidedContent(UploadServiceImpl.java:632)
at org.artifactory.engine.UploadServiceImpl.uploadItem(UploadServiceImpl.java:499)
at org.artifactory.engine.UploadServiceImpl.uploadFile(UploadServiceImpl.java:489)
at org.artifactory.engine.UploadServiceImpl.uploadArtifact(UploadServiceImpl.java:468)
at org.artifactory.engine.UploadServiceImpl.adjustResponseAndUpload(UploadServiceImpl.java:280)
at org.artifactory.engine.UploadServiceImpl.validateRequestAndUpload(UploadServiceImpl.java:246)
at org.artifactory.engine.UploadServiceImpl.upload(UploadServiceImpl.java:189)
at jdk.internal.reflect.GeneratedMethodAccessor707.invoke(Unknown Source)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base@11.0.13/DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(java.base@11.0.13/Method.java:566)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.artifactory.request.aop.RequestAdvice.invoke(RequestAdvice.java:67)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
at com.sun.proxy.$Proxy414.upload(Unknown Source)
at org.artifactory.webapp.servlet.RepoFilter.doUpload(RepoFilter.java:307)
at org.artifactory.webapp.servlet.RepoFilter.execute(RepoFilter.java:185)
.
.
.

at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(java.base@11.0.13/Thread.java:829)
Locked ownable synchronizers:
- <0x000000036c828778> (a org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker)


2. Free Up Disk Space: Ensure there is enough disk space on the server. Files in the _pre folder can accumulate over time if Artifactory encounters issues moving files. If the disk becomes full, Artifactory may struggle to process files efficiently.

3. Increase System Resources: If the problem is related to memory or processing power (e.g., OutOfMemory errors), consider increasing the server’s resources.

4. Monitor the System for Long-Running Processes: Keep an eye on processes that might be stuck or hanging, especially those involving file uploads or checksum calculations. Use tools like top, htop, or Artifactory’s internal logs to identify any processes taking too long.


Conclusion

The _pre folder in Artifactory is an essential part of the file handling process, but if not properly managed, it can lead to performance issues. Orphaned files, accumulated temporary files, or system resource issues can cause Artifactory to slow down or fail to process files correctly. Regularly monitor and manage the contents of the _pre folder, and troubleshoot system performance with thread dumps and system resource monitoring to ensure that Artifactory runs efficiently. By understanding the role of the _pre folder and being proactive in managing its contents, administrators can avoid performance bottlenecks and ensure Artifactory remains stable and responsive.
For more information on managing specifications, please refer to JFrog Platform: Reference Architecture.