Uploaded image for project: 'Migration Platform'
  1. Migration Platform
  2. MIG-1300

Deadlock while using Confluence Cloud Migration Assistant 3.4.0 with MSSQL database.

XMLWordPrintable

    • 15
    • Severity 1 - Critical

      Issue Summary

      When trying to migrate attachments and spaces using CCMA 3.40, database deadlock errors are observed in the logs. This issue happens with the MSSQL server database.

      This is reproducible on Data Center:

      Steps to Reproduce

      1. Install CCMA 3.4.0 on a Confluence configured with the MSSQL database.
      2. Try to create a migration plan with more than 5 spaces.
      3. Some of the spaces fail with the deadlock errors highlighted below.

      Expected Results

      Migration should be successful.

      Actual Results

      The below exception is thrown in the atlassian-confluence.log file:

      java.util.concurrent.CompletionException: javax.persistence.OptimisticLockException: org.hibernate.exception.LockAcquisitionException: could not execute batch
      	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:314)
      	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:319)
      	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1739)
      	at com.atlassian.migration.agent.logging.LoggingContextAwareExecutorService.lambda$execute$3(LoggingContextAwareExecutorService.java:104)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      	at java.base/java.lang.Thread.run(Thread.java:834)
      Caused by: javax.persistence.OptimisticLockException: org.hibernate.exception.LockAcquisitionException: could not execute batch
      	at org.hibernate.internal.ExceptionConverterImpl.wrapLockException(ExceptionConverterImpl.java:277)
      	at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:98)
      	at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181)
      	at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:188)
      	at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1395)
      	at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:482)
      	at org.hibernate.internal.SessionImpl.flushBeforeTransactionCompletion(SessionImpl.java:3274)
      	at org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:2409)
      	at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.beforeTransactionCompletion(JdbcCoordinatorImpl.java:448)
      	at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.beforeCompletionCallback(JdbcResourceLocalTransactionCoordinatorImpl.java:183)
      	at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.access$300(JdbcResourceLocalTransactionCoordinatorImpl.java:40)
      	at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commit(JdbcResourceLocalTransactionCoordinatorImpl.java:281)
      	at org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:101)
      	at com.atlassian.migration.agent.store.jpa.impl.DefaultPluginTransactionTemplate.on(DefaultPluginTransactionTemplate.java:37)
      	at com.atlassian.migration.agent.store.tx.PluginTransactionTemplate.on(PluginTransactionTemplate.java:9)
      	at com.atlassian.migration.agent.store.tx.PluginTransactionTemplate.write(PluginTransactionTemplate.java:28)
      	at com.atlassian.migration.agent.service.stepexecutor.ProgressTracker.withStepAndWriteTx(ProgressTracker.java:391)
      	at com.atlassian.migration.agent.service.stepexecutor.ProgressTracker.progress(ProgressTracker.java:133)
      	at com.atlassian.migration.agent.service.stepexecutor.attachment.AttachmentMigrationExecutor.lambda$doAttachmentMigration$3(AttachmentMigrationExecutor.java:270)
      	at com.atlassian.migration.agent.service.stepexecutor.attachment.AttachmentsUploadTracker.attachmentUploaded(AttachmentsUploadTracker.java:56)
      	at com.atlassian.migration.agent.service.stepexecutor.attachment.AttachmentsToMigrateConsumer.run(AttachmentsToMigrateConsumer.java:63)
      	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1736)
      	... 4 more
      Caused by: org.hibernate.exception.LockAcquisitionException: could not execute batch
      	at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:120)
      	at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
      	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)
      	at org.hibernate.engine.jdbc.batch.internal.BatchingBatch.performExecution(BatchingBatch.java:131)
      	at org.hibernate.engine.jdbc.batch.internal.BatchingBatch.doExecuteBatch(BatchingBatch.java:106)
      	at org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.execute(AbstractBatchImpl.java:148)
      	at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.executeBatch(JdbcCoordinatorImpl.java:198)
      	at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:633)
      	at org.hibernate.engine.spi.ActionQueue.lambda$executeActions$1(ActionQueue.java:478)
      	at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
      	at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:475)
      	at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:344)
      	at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:40)
      	at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:107)
      	at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1391)
      	... 21 more
      Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Transaction (Process ID 529) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
      	at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:260)
      	at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1547)
      	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatementBatch(SQLServerPreparedStatement.java:2632)
      	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtBatchExecCmd.doExecute(SQLServerPreparedStatement.java:2520)
      	at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7342)
      	at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2688)
      	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:224)
      	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:204)
      	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeBatch(SQLServerPreparedStatement.java:2431)
      	at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:2544)
      	at org.hibernate.engine.jdbc.batch.internal.BatchingBatch.performExecution(BatchingBatch.java:121)
      	... 32 more
      

      Workaround

      Currently, there is no known workaround for this behavior. A workaround will be added here when available

            a3f474913183 Adam Miritis
            54bf2707b706 Deepak Pandey
            Votes:
            4 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              Resolved: