Atlassian Cloud Migration Assistant fails to start with "Could not acquire change log lock" error
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Atlassian Cloud Migration Assistant fails to start and throws exceptions
Diagnosis
This issue comes when users try to start the Migration Assistant app on their on premise Confluence and get below error
Causeorg.apache.velocity.exception.MethodInvocationException: Invocation of method 'getInitialState' in class com.atlassian.migration.agent.web.AppAction threw exception com.atlassian.util.concurrent.LazyReference$InitializationException: javax.persistence.PersistenceException: Failed to update database schema at /templates/app.vm[line 21, column 44] at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:228)
caused by: com.atlassian.util.concurrent.LazyReference$InitializationException: javax.persistence.PersistenceException: Failed to update database schema at com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:149)
caused by: javax.persistence.PersistenceException: Failed to update database schema at com.atlassian.migration.agent.store.jpa.impl.LiquibaseSchemaUpgrader.upgrade(LiquibaseSchemaUpgrader.java:35)
caused by: liquibase.exception.LockException: Could not acquire change log lock. Currently locked by DEMAG01WIKI01 (10.128.3.89) since 08.10.19 12:22 at liquibase.lockservice.StandardLockService.waitForLock(StandardLockService.java:230)
Stack Trace:[hide]org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getInitialState' in class com.atlassian.migration.agent.web.AppAction threw exception com.atlassian.util.concurrent.LazyReference$InitializationException: javax.persistence.PersistenceException: Failed to update database schema at /templates/app.vm[line 21, column 44] at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:228) at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:262) at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:342) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at com.atlassian.confluence.util.ClusterHeaderFilter.doFilter(ClusterHeaderFilter.java:57) at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:32) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.orm.hibernate.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:170) at com.atlassian.confluence.web.filter.ConfluenceOpenSessionInViewFilter.doFilterInternal( at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:37) at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.lambda$doFilter$0(DelegatingPluginFilter.java:57) at com.atlassian.confluence.extra.webdav.servlet.filter.WebdavRequestForwardFilter.doFilter( at java.base/java.lang.Thread.run(Unknown Source)Caused by: com.atlassian.util.concurrent.LazyReference$InitializationException: javax.persistence.PersistenceException: Failed to update database schema at com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:149)
Caused by: javax.persistence.PersistenceException: Failed to update database schema at com.atlassian.migration.agent.store.jpa.impl.LiquibaseSchemaUpgrader.upgrade(LiquibaseSchemaUpgrader.java:35) at com.atlassian.migration.agent.store.jpa.impl.DefaultSessionFactorySupplier.buildSessionFactory(DefaultSessionFactorySupplier.java:70) at com.atlassian.util.concurrent.Lazy$Strong.create(Lazy.java:85) at com.atlassian.util.concurrent.LazyReference$Sync.run(LazyReference.java:325) at com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:143) at com.atlassian.util.concurrent.LazyReference.get(LazyReference.java:112) at com.atlassian.migration.agent.store.jpa.impl.DefaultSessionFactorySupplier.get(DefaultSessionFactorySupplier.java:65) at com.atlassian.migration.agent.store.jpa.impl.DefaultSessionFactorySupplier.get(DefaultSessionFactorySupplier.java:40) at com.atlassian.migration.agent.store.jpa.impl.DefaultPluginTransactionTemplate.on(DefaultPluginTransactionTemplate.java:29) at com.atlassian.migration.agent.store.tx.PluginTransactionTemplate.read(PluginTransactionTemplate.java:16) at com.atlassian.migration.agent.service.impl.DefaultStatisticsService.loadSpaceStatistics(DefaultStatisticsService.java:126) at com.atlassian.migration.agent.service.impl.DefaultStatisticsService.calculateServerStats(DefaultStatisticsService.java:155) at com.atlassian.migration.agent.service.impl.SingleJobExecutor.lambda$execute$0(SingleJobExecutor.java:33) at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ... 1 moreCaused by: liquibase.exception.LockException: Could not acquire change log lock. Currently locked by DEMAG01WIKI01 (10.128.3.89) since 08.10.19 12:22 at liquibase.lockservice.StandardLockService.waitForLock(StandardLockService.java:230) at liquibase.Liquibase.update(Liquibase.java:184) at liquibase.Liquibase.update(Liquibase.java:179) at com.atlassian.migration.agent.store.jpa.impl.LiquibaseSchemaUpgrader.upgrade(LiquibaseSchemaUpgrader.java:30) ... 16 more
with main error being
com.atlassian.migration.agent.store.jpa.impl.LiquibaseSchemaUpgrader.upgrade(LiquibaseSchemaUpgrader.java:35) caused by: liquibase.exception.LockException: Could not acquire change log lock. Currently locked by DEMAG01WIKI01 (10.128.3.89) since 08.10.19 12:22 at liquibase.lockservice.StandardLockService.waitForLock(StandardLockService.java:230)
Cause
This issue occurred as the MIG_DB_CHANGELOG_LOCK
table has not been updated with the release lock information and this is likely to be caused by force termination of Confluence while it was trying to migrate the Database schema after an upgrade.
The MIG_DB_CHANGELOG_LOCK
table is related to the Cloud Migration Assistant for Confluence plugin which is bundled by default since Confluence 6.14.
Solution
You can follow the below workaround to resolve this issue:
To release the lock manually by executing the SQL query below in the Confluence Database.
UPDATE MIG_DB_CHANGELOG_LOCK SET LOCKED=false, LOCKGRANTED=null, LOCKEDBY=null where ID=1;
UPDATE MIG_DB_CHANGELOG_LOCK SET LOCKED=0, LOCKGRANTED=null, LOCKEDBY=null where ID=1;
- Restart Confluence.