Bitbucket Server Does Not Start - Could not acquire change log lock

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

問題

Option#1: Bitbucket Server does not start and the following error can be seen in the atlassian-bitbucket.log:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [bitbucket-context.xml]: Invocation of init method failed; nested exception is liquibase.exception.LockException: Could not acquire change log lock.  Currently locked by fe80:0:0:0:a00:27ff:fe6a:c787%2 (fe80:0:0:0:a00:27ff:fe6a:c787%2) since 12/6/12 2:08 PM


Option#2: Bitbucket Data Center has the nodes hosted in Docker containers. During the full cluster restart with (docker stop) the startup hangs on the setting the lock for the filesystem:

[spring-startup]  c.a.s.internal.home.HomeLockAcquirer Successfully acquired lock on home directory /var/atlassian/bitbucket-home/atlassian-bitbucket-5.16.0


原因

The DATABASECHANGELOGLOCK table has not been updated with the release lock information.

The likely cause of this is that the Bitbucket Server instance was forced to quit while it was trying to migrate the database schema after an upgrade, with the consequence that the lock was not released. You should always wait for Bitbucket Server to start up sufficiently for it to provide error messages if there are schema migration problems – never assume that it has hung and kill the process.

Another possible cause of not releasing the lock is that Bitbucket Server was forced to quit while performing automatic application setup.

ソリューション

Bitbucket Server needs an exclusive lock on the DATABASECHANGELOGLOCK table in order to start so take care to disconnect / close the tool used to update the database. If you do not do this you may experience Bitbucket Server hanging on start up with no errors in the logs and no response from the web server.

Click here to expand for MySQL and SQL Server
 UPDATE DATABASECHANGELOGLOCK SET LOCKED=0, LOCKGRANTED=null, LOCKEDBY=null where ID=1;
Click here to expand for Oracle
 UPDATE DATABASECHANGELOGLOCK SET LOCKED=0, LOCKGRANTED=null, LOCKEDBY=null where ID=1;
 commit;
PostgreSQL 用は、ここをクリックして展開してください。
 UPDATE databasechangeloglock SET LOCKED=false, LOCKGRANTED=null, LOCKEDBY=null where ID=1;
Click here to expand for HSQLDB

About Production Environments

We don't recommend the usage of HSQL for production environments. Please refer to Connect Bitbucket to an external database for a proper production environment deployment.

1- Shutdown Bitbucket Server

2- Open your <BITBUCKET_HOME>/data/db.script and look for a string like:

INSERT INTO DATABASECHANGELOGLOCK VALUES(1,TRUE,'2012-06-12 14:08:00.982000','fe80:0:0:0:a00:27ff:fe6a:c787%2 (fe80:0:0:0:a00:27ff:fe6a:c787%2)')

And substitute it by the one below:

INSERT INTO DATABASECHANGELOGLOCK VALUES(1,FALSE, NULL,NULL )

3- Restart Bitbucket Server

Click here to expand for H2 Embedded Database

About Production Environments

We don't recommend the usage of H2 Embedded Database for production environments. Please refer to Connect Bitbucket to an external database for a proper production environment deployment.

  1. Stop Bitbucket Server
  2. Login to the server as the user that runs Bitbucket Server
  3. Run the following command which will open a console connection to the database:

    You'll want to update the path below to reflect where Bitbucket Server is installed and select the h2 jar. By default it is stored in:

    /opt/atlassian/bitbucket/<Release_Number>
    java -cp <BITBUCKET_INSTALL>/atlassian-bitbucket/WEB-INF/lib/h2-1.3.176.jar org.h2.tools.Shell
  4. When prompted for the URL enter:

    You'll want to verify that the path below points your DB. By default it is stored in:

    /var/atlassian/application-data
    jdbc:h2:file://<$BITBUCKET_HOME>/bitbucket/shared/data/db;DB_CLOSE_ON_EXIT=TRUE
  5. Press enter when asked which driver to use
  6. Enter sa for the user
  7. Press enter twice when prompted for the password (no password is required)

This should leave you with a sql> prompted and you can run the update query below:

UPDATE databasechangeloglock SET LOCKED=false, LOCKGRANTED=null, LOCKEDBY=null where ID=1;


最終更新日 2018 年 11 月 27 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.