Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-86940

Upgrade to 7.1: Unable to add the journal article image into the file repository for SQL Server

    Details

    • Fix Priority:
      4
    • Databases:
      SQL Server 2016
    • Sprint:
      LIMA | #02 | Sep03-Sep17

      Description

      Steps to reproduce it:

      1. Startup 6.2 or 7.0 with SQL Server
      2. Create a WC Structure with an image field (JournalArticle field)
      3. Create a WC Template for that structure
      4. Create hundreds of articles using that field (you should finally have more than 2000 records in JournalArticleImage table)
      5. Upgrade to master/7.1

      *Results:
      The following exception is thrown several times:

      2018-10-08 22:32:53.061 INFO  [main][LoggingTimer:73] Starting com.liferay.journal.internal.upgrade.v1_1_0.UpgradeImageTypeContent#copyJournalArticleImagesToJournalRepository
      INFO - Starting com.liferay.journal.internal.upgrade.v1_1_0.UpgradeImageTypeContent#copyJournalArticleImagesToJournalRepository
      2018-10-08 22:33:20.723 ERROR [ForkJoinPool-2-worker-6][JDBCExceptionReporter:234] Transaction (Process ID 67) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
      2018-10-08 22:33:20.732 ERROR [ForkJoinPool-2-worker-6][UpgradeImageTypeContent:160] Unable to add the journal article image 5263514 into the file repository
      org.springframework.dao.CannotAcquireLockException: Could not execute JDBC batch update; SQL [update DLFileVersion set uuid_=?, groupId=?, companyId=?, userId=?, userName=?, createDate=?, modifiedDate=?, repositoryId=?, folderId=?, fileEntryId=?, treePath=?, fileName=?, extension=?, mimeType=?, title=?, description=?, changeLog=?, extraSettings=?, fileEntryTypeId=?, version=?, size_=?, checksum=?, lastPublishDate=?, status=?, statusByUserId=?, statusByUserName=?, statusDate=? where fileVersionId=?]; nested exception is org.hibernate.exception.LockAcquisitionException: Could not execute JDBC batch update
      	at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:650)
      	at org.springframework.orm.hibernate3.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:800)
      	at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:670)
      	at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:757)
      	at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:726)
      	at com.liferay.portal.spring.transaction.DefaultTransactionExecutor._commit(DefaultTransactionExecutor.java:128)
      	at com.liferay.portal.spring.transaction.DefaultTransactionExecutor.commit(DefaultTransactionExecutor.java:36)
      	at com.liferay.portal.spring.transaction.DefaultTransactionExecutor.execute(DefaultTransactionExecutor.java:62)
      	at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:58)
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:133)
      	at com.liferay.portal.service.ServiceContextAdvice.invoke(ServiceContextAdvice.java:51)
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:133)
      	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:133)
      	at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:139)
      	at com.sun.proxy.$Proxy121.updateStatus(Unknown Source)
      	at com.liferay.portal.repository.capabilities.util.DLFileEntryServiceAdapter.updateStatus(DLFileEntryServiceAdapter.java:159)
      	at com.liferay.document.library.internal.repository.capabilities.MinimalWorkflowCapability.doUpdateStatus(MinimalWorkflowCapability.java:110)
      	at com.liferay.document.library.internal.repository.capabilities.MinimalWorkflowCapability.addFileEntry(MinimalWorkflowCapability.java:54)
      	at com.liferay.portal.repository.liferayrepository.LiferayWorkflowLocalRepositoryWrapper.addFileEntry(LiferayWorkflowLocalRepositoryWrapper.java:59)
      	at com.liferay.portal.repository.capabilities.CapabilityLocalRepository.addFileEntry(CapabilityLocalRepository.java:60)
      	at com.liferay.portal.portletfilerepository.PortletFileRepositoryImpl.addPortletFileEntry(PortletFileRepositoryImpl.java:162)
      	at com.liferay.portal.portletfilerepository.PortletFileRepositoryImpl.addPortletFileEntry(PortletFileRepositoryImpl.java:109)
      	at com.liferay.portal.kernel.portletfilerepository.PortletFileRepositoryUtil.addPortletFileEntry(PortletFileRepositoryUtil.java:59)
      	at com.liferay.journal.internal.upgrade.v1_1_0.UpgradeImageTypeContent$SaveImageFileEntryCallable.call(UpgradeImageTypeContent.java:153)
      	at com.liferay.journal.internal.upgrade.v1_1_0.UpgradeImageTypeContent$SaveImageFileEntryCallable.call(UpgradeImageTypeContent.java:123)
      	at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
      	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
      	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
      	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
      	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
      Caused by: org.hibernate.exception.LockAcquisitionException: Could not execute JDBC batch update
      	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:107)
      	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
      	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
      	at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:114)
      	at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:109)
      	at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:244)
      	at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2542)
      	at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2495)
      	at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2822)
      	at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:113)
      	at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273)
      	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:265)
      	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:185)
      	at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
      	at com.liferay.portal.dao.orm.hibernate.event.NestableFlushEventListener.onFlush(NestableFlushEventListener.java:61)
      	at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)
      	at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:383)
      	at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:133)
      	at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:662)
      	... 28 more
      

      And the journal upgrade does not finished.

      Expected results:
      No exceptions and the upgrade finishes properly.

      Technical analysis:
      It seems a kind of race condition adding files to the DL repository. The error happened for 52 out of 2190 journalAricleImages and it occurs when the logic tries to set the status after creating the DLFileEntry.

      All JournalArticleImages are created as DLFileEntries (the purpose of the upgrade) but some of them remain in the draft status (2). You can check the ones which have failed using this query after the upgrade:

      select * from DLFileVersion where status = 2
      

        Attachments

          Activity

            People

            Assignee:
            support-lep@liferay.com SE Support
            Reporter:
            alberto.chaparro Alberto Chaparro
            Participants of an Issue:
            Recent user:
            Yvonne Han
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Days since last comment:
              2 years, 6 weeks, 4 days ago

                Packages

                Version Package