Issue Description
When uploading files to the Artifactory repo, you may encounter the "java.nio.file. FileAlreadyExistsException: /opt/jfrog/artifactory/var/data/artifactory/filestore/xx" error, which causes the file upload failed.
The errors example is as follows:
2024-12-08T07:59:32.206Z [jfrt ] [INFO ] [42f95f8618b4a691] [o.a.e.UploadServiceImpl:504 ] [http-nio-8081-exec-7] - Deploy to 'example-repo-local:testfile' Content-Length: 0 (estimation) artificial: false
2024-12-08T07:59:32.208Z [jfrt ] [ERROR] [42f95f8618b4a691] [o.a.w.s.RepoFilter:336 ] [http-nio-8081-exec-7] - Upload request of example-repo-local:testfile failed due to {}
java.nio.file.FileAlreadyExistsException: /opt/jfrog/artifactory/var/data/artifactory/filestore/xx
at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:94)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
at java.base/sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:397)
at java.base/java.nio.file.Files.createDirectory(Files.java:700)
at java.base/java.nio.file.Files.createAndCheckIsDirectory(Files.java:807)
at java.base/java.nio.file.Files.createDirectories(Files.java:753)
......
......
2024-12-08T07:59:32.208Z [jfrt ] [WARN ] [42f95f8618b4a691] [o.a.w.s.RepoFilter:337 ] [http-nio-8081-exec-7] - Sending HTTP error code 404: /opt/jfrog/artifactory/var/data/artifactory/filestore/xx
Issue Cause
The cause of the problem may be that the "/opt/jfrog/artifactory/var/data/artifactory/filestore/xx" directory is a soft link.
When uploading files to Artifactory repo, the Artifactory will create a directory with the first two str of the file sha1 value under the filestore directory.
For example:
Upload a file to Artifactory repo and the file sha1 is "63bea2e3b0c7cd2d1f98bc5b7a9951eafcfead0f".
When uploading the file to Artifactory, Artifactory will check the directory that named first two str of the file sha1 whether it exists. If the directory does not exist, it will be created.
If the directory that named first two str of the file sha1 is a soft link, it will return errors like "java.nio.file.FileAlreadyExistsException: /opt/jfrog/artifactory/var/data/artifactory/filestore/xx" when Artifactory creating the directory..
Resolution
The Artifactory does not allow to create the soft link named first two str of the file sha1 value in the filestore directory. If the disk space is insufficient, it is recommended to expand the capacity of the filestore.
For details about how to expand the capacity of the filestore, please refer to Filestore Configuration or seek help from JFrog Support.