Skip to main content
Planview Customer Success Center

Log reads “Failed to acquire database lease. The database is in use by another instance of Hub.” What has happened?

Last Updated:    |  Applicable Hub Versions: 17.4 and later

Answer

There is a new safeguard with Hub version 17.4 to ensure that multiple instances of Hub cannot be run over the same database. Even though this technically isn’t possible with Hub’s default Apache Derby database, the same logic runs regardless of whether you are using an external database or the Derby database. It is possible that this issue came about after an upgrade to 17.4, if during the upgrade process Hub was killed and may not have been cleanly shutdown.

Error seen in Logs: 2017-11-14 09:21:40,808 [localhost-startStop-1] INFO com.tasktop.services.sql.liquibase – ChangeSet com/tasktop/internal/services/sql/check-indexes.xml::check-indexes::platform ran successfully in 203ms 2017-11-14 09:21:40,855 [localhost-startStop-1] INFO com.tasktop.services.sql.liquibase – Continuing past: com/tasktop/internal/services/sql/lease/platform-lease.xml::create-platform-lease-record::platform despite precondition failure due to onFail=‘CONTINUE’: com.tasktop.internal.services.sql : SQL Precondition failed. Expected ‘0’ got '1'

2017-11-14 09:21:40,917 [localhost-startStop-1] INFO com.tasktop.services.sql.liquibase – Successfully released change log lock
2017-11-14 09:21:40,933 [localhost-startStop-1] INFO com.tasktop.services.sql.SqlDatabaseInitializer – Database initialization complete
2017-11-14 09:21:40,964 [localhost-startStop-1] ERROR com.tasktop.internal.services.sql.lease.SqlPlatformLeaseStore – Failed to acquire database lease. The database is in use by another instance of Hub.

Solution:

In 17.4 - 18.1.5

Below are the steps to be able to clear this lock:

  1. Download http://archive.apache.org/dist/db/derby/db-derby-10.12.1.1/db-derby-10.12.1.1-lib.zip for Windows or http://archive.apache.org/dist/db/derby/db-derby-10.12.1.1/db-derby-10.12.1.1-lib.tar.gz for Linux
  2. Unzip the archive.
  3. Stop Hub.
  4. Open the command prompt with administrative privileges and go to the "lib" directory inside the directory where you unzipped the derby archive.
  5. Run this command, where <Tasktop Install Location> is C:\Program Files\Tasktop on Windows by default, or wherever you unzipped Hub on Linux:

    <Tasktop Install Location>/jre/bin/java -cp * org.apache.derby.tools.ij
  6. To clear the lock, execute the following command, where ProgramData/Tasktop/db/com.tasktop.platform is the path to the Hub database directory.

    connect 'jdbc:derby:/ProgramData/Tasktop/db/com.tasktop.platform';
    select * from platform_lease;
    truncate table platform_lease; 
    select * from platform_lease;  
    exit; 

    Note: If you do not see data in the table, there is a separate issue causing the database lock.

  7. Start Tasktop.
  8. If you are not comfortable with these steps or need additional assistance, please contact support for further instructions. If you are using an external database, you can remove the database lease if there are no other systems connected to it using your SQL tool of choice.

In 18.1.6 and later:

In version 18.1.6 and later, you will be prompted to override the database lease. You can see details here.