ARTIFACTORY: How to resolve the “WARNING: Found an init lock in the DB, but the owner is the not the current node” error
Subject: Artifactory fails to start with “WARNING: Found an init lock in the DB, but the owner is the not the current node” message in the logs.
Affected Versions: Artifactory 7.x
DescriptionWhen deploying Artifactory in an environment where the IP address may change, such as when redeploying Artifactory on an EC2 instance or migrating Artifactory to a new machine with a new IP address while still using the existing database, you may encounter a problem where Artifactory fails to start and generates an error message in the logs, such as the one below:
WARNING: Found an init lock in the DB, but the owner is not the current node. Found: 'ip-100-100-100-1', current: 'ip-100-100-100-2'. The lock will not be released to allow 'ip-100-100-100-1' to finish the startup phase, and this node will wait until it's released. Please note that parallel initialization of nodes during an upgrade or on a vanilla installation is not supported, and you may need to restart this node for it to startup successfully after 'ip-100-100-100-1' finishes booting up.
This indicates that a lock was established in the lock table of the database with an "artifactory-init" event for a previous Artifactory instance, but it was not cleared. This lock prevents a new instance from running the initialization process and starting the instance.
Resolution
In most cases, restarting the database should clear the lock.
However, if the issue persists, access the database and check the following table
SELECT * FROM distributed_locks; category | lock_key | owner | owner_thread | owner_thread_name | acquire_time -------------------+------------------+------------------------------+--------------+--------------------+--------------- cluster_singleton | artifactory-init | ip-100-100-100-1 | 16 | Catalina-utility-2 | 1672531200000 (1 row)
Look for a row with a "lock_key" value of "artifactory-init".
We recommend creating a backup of the table before deleting the row with the 'artifactory-init' lock_key from the table. After deleting the row, you can restart Artifactory, and the lock should be cleared, allowing Artifactory to start up normally.