ARTIFACTORY: What to Do When You Get a Binary provider has no content for Error Message

Maayan Amrani
2021-05-25 07:47

This error can appear in your Artifactory or Catalina logs for several reasons, some of which are of critical importance. These include:

  • A physical binary file is inaccessible or not present in the filestore. A misconfiguration of your binarystore.xml can result in Artifactory looking for binary files in an incorrect folder. Mishandling of binary files (either in each storage shard, eventual folder, S3, or any filestore) can result in a state in which your DB thinks Artifactory has a given binary file, but the physical file is not accessible or has been lost. The lost binary files should be recovered or DB should be updated to remove those binaries can not be located (see "Resolution" below for more details).

  • Solution: Configure your binarystore.xml such that it’s pointing to the correct filestore. Merge in any newly created binary files by manually moving those files from the incorrect filestore to the correct filestore, being certain to place them in the correct folders (first two digits of SHA-1).

  • If the file that appears in the error is a metadata file, this could be because the artifact manipulation and the Backup task are overlapping. In this case, a metadata file has changed due to an artifact being added or removed, therefore, changing its checksum which causes the maven index task to mark the old metadata file for deletion, or a file was simply deleted in the middle of the process. The backup starts, indexes all of the files to be exported, an artifact is changed, added or removed, metadata is recalculated (and its checksum) and then when the backup reaches that file it cannot find the corresponding checksum for the metadata.

  • Solution: If you have any binary files that were deleted by mistake, do the following to identify and remove irrelevant database entries in Oracle or Postgres DBs (Note: Other DB types may need modifications for queries.)

 

1. Make a backup of your current database (important) and filestore.

2. Find the checksum files that are referenced in your database, but which don’t exist in any filestore that Artifactory uses (e.g., each shard, each eventual folder, S3, or folder). More information on how to do this is available HERE.

3. See if the checksum files can be recovered from a backup location or another Artifactory instance. Merge in any newly created binary files by manually copying the files from backup filestore to the target filestore, being certain to place them in the correct folders (first two digits of SHA-1).

4. Should you determine that the checksum files cannot be located and you decide to remove related database entries, use the following steps. You may run Step #2 again to get the updated list of checksum files that need to be removed from the database.

After obtaining a list of checksum values (SHA-1), run the queries in the order they appear below. Make sure that each checksum value is set off inside single quotation marks, replacing the checksums offered in the following examples with those of your own.

delete from indexed_archives_entries where indexed_archives_id in (select indexed_archives_id from indexed_archives where archive_sha1 in ('d6442ecb3d2f18a393ffd6bc84af1d895b752347','8282779494c879917e2a3efb454eb41a989ceca4'));
delete from indexed_archives where archive_sha1 in ('d6442ecb3d2f18a393ffd6bc84af1d895b752347','8282779494c879917e2a3efb454eb41a989ceca4');
delete from node_meta_infos where node_id in (select node_id from nodes where sha1_actual in ('d6442ecb3d2f18a393ffd6bc84af1d895b752347','8282779494c879917e2a3efb454eb41a989ceca4'));
delete from node_props where node_id in (select node_id from nodes where SHA1_ACTUAL in ('d6442ecb3d2f18a393ffd6bc84af1d895b752347','8282779494c879917e2a3efb454eb41a989ceca4'));
delete from stats where node_id in (select node_id from nodes where SHA1_ACTUAL in ('d6442ecb3d2f18a393ffd6bc84af1d895b752347','8282779494c879917e2a3efb454eb41a989ceca4'));
delete from watches where node_id in (select node_id from nodes where SHA1_ACTUAL in ('d6442ecb3d2f18a393ffd6bc84af1d895b752347','8282779494c879917e2a3efb454eb41a989ceca4'));
delete from nodes where node_id in (select node_id from nodes where SHA1_ACTUAL in ('d6442ecb3d2f18a393ffd6bc84af1d895b752347','8282779494c879917e2a3efb454eb41a989ceca4'));
delete from binaries where sha1 in ('d6442ecb3d2f18a393ffd6bc84af1d895b752347','8282779494c879917e2a3efb454eb41a989ceca4'); 

5. Verify that your artifactory.log no longer shows the Binary provider has no content for error message. Additionally, make an extra effort not to have an occurrence of this problem by determining and fixing the root cause(s) of this issue.

Published: Mar. 3, 2020
Last updated: May 18, 2021

Keywords: binarystore.xml Binary Provider