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

As a developer I would like to avoid ormexceptions occuring while amending backgroundTasks

    Details

    • Fix Priority:
      2

      Description

      On portal startup occasionally an error like below occurs:

      17:06:39,845 ERROR [liferay/background_task-1][ParallelDestination:55] Unable to process message {destinationName=liferay/background_task, response=null, responseDestinationName=null, responseId=null, payload=null, values={defaultLocale=en_US, groupId=0, companyId=20202, backgroundTaskId=30901}}
      com.liferay.portal.kernel.messaging.MessageListenerException: com.liferay.portal.kernel.exception.SystemException: com.liferay.portal.kernel.dao.orm.ORMException: {mvccVersion=0, backgroundTaskId=30901, groupId=0, companyId=0, userId=0, userName=, createDate=Mon Mar 21 16:58:57 GMT 2016, modifiedDate=Mon Mar 21 17:03:18 GMT 2016, name=reindexOnActivate#com.liferay.portal.kernel.plugin.PluginPackage, servletContextNames=, taskExecutorClassName=com.liferay.portal.search.internal.background.task.ReindexSingleIndexerBackgroundTaskExecutor, taskContextMap={deleteOnSuccess=true, className=com.liferay.portal.kernel.plugin.PluginPackage, companyIds=[J@780f9040, threadLocalValues={defaultLocale=en_US, clusterInvoke=true, groupId=0, principalName=null, siteDefaultLocale=null, companyId=20202, themeDisplayLocale=null}}, completed=false, completionDate=null, status=1, statusMessage=} is stale in comparison to {mvccVersion=1, backgroundTaskId=30901, groupId=0, companyId=0, userId=0, userName=, createDate=2016-03-21 16:58:57.487, modifiedDate=2016-03-21 16:58:57.487, name=reindexOnActivate#com.liferay.portal.kernel.plugin.PluginPackage, servletContextNames=, taskExecutorClassName=com.liferay.portal.search.internal.background.task.ReindexSingleIndexerBackgroundTaskExecutor, taskContextMap={deleteOnSuccess=true, className=com.liferay.portal.kernel.plugin.PluginPackage, companyIds=[Ljava.lang.Integer;@39f17ce3, threadLocalValues={defaultLocale=en_US, groupId=0, clusterInvoke=true, principalName=null, siteDefaultLocale=null, companyId=20202, themeDisplayLocale=null}}, completed=false, completionDate=null, status=0, statusMessage=}
      at com.liferay.portal.kernel.messaging.BaseMessageListener.receive(BaseMessageListener.java:32)
      at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessageListener.java:74)
      at com.liferay.portal.kernel.messaging.ParallelDestination$1.run(ParallelDestination.java:52)
      at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask._runTask(ThreadPoolExecutor.java:756)
      at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask.run(ThreadPoolExecutor.java:667)
      at java.lang.Thread.run(Thread.java:745)
      Caused by: com.liferay.portal.kernel.exception.SystemException: com.liferay.portal.kernel.dao.orm.ORMException: {mvccVersion=0, backgroundTaskId=30901, groupId=0, companyId=0, userId=0, userName=, createDate=Mon Mar 21 16:58:57 GMT 2016, modifiedDate=Mon Mar 21 17:03:18 GMT 2016, name=reindexOnActivate#com.liferay.portal.kernel.plugin.PluginPackage, servletContextNames=, taskExecutorClassName=com.liferay.portal.search.internal.background.task.ReindexSingleIndexerBackgroundTaskExecutor, taskContextMap={deleteOnSuccess=true, className=com.liferay.portal.kernel.plugin.PluginPackage, companyIds=[J@780f9040, threadLocalValues={defaultLocale=en_US, clusterInvoke=true, groupId=0, principalName=null, siteDefaultLocale=null, companyId=20202, themeDisplayLocale=null}}, completed=false, completionDate=null, status=1, statusMessage=} is stale in comparison to {mvccVersion=1, backgroundTaskId=30901, groupId=0, companyId=0, userId=0, userName=, createDate=2016-03-21 16:58:57.487, modifiedDate=2016-03-21 16:58:57.487, name=reindexOnActivate#com.liferay.portal.kernel.plugin.PluginPackage, servletContextNames=, taskExecutorClassName=com.liferay.portal.search.internal.background.task.ReindexSingleIndexerBackgroundTaskExecutor, taskContextMap={deleteOnSuccess=true, className=com.liferay.portal.kernel.plugin.PluginPackage, companyIds=[Ljava.lang.Integer;@39f17ce3, threadLocalValues={defaultLocale=en_US, groupId=0, clusterInvoke=true, principalName=null, siteDefaultLocale=null, companyId=20202, themeDisplayLocale=null}}, completed=false, completionDate=null, status=0, statusMessage=}
      at com.liferay.portal.kernel.service.persistence.impl.BasePersistenceImpl.processException(BasePersistenceImpl.java:264)
      at com.liferay.portal.background.task.service.persistence.impl.BackgroundTaskPersistenceImpl.updateImpl(BackgroundTaskPersistenceImpl.java:8507)
      at com.liferay.portal.background.task.service.persistence.impl.BackgroundTaskPersistenceImpl.updateImpl(BackgroundTaskPersistenceImpl.java:72)
      at com.liferay.portal.kernel.service.persistence.impl.BasePersistenceImpl.update(BasePersistenceImpl.java:345)
      at com.liferay.portal.background.task.service.impl.BackgroundTaskLocalServiceImpl.amendBackgroundTask(BackgroundTaskLocalServiceImpl.java:199)
      at com.liferay.portal.background.task.service.impl.BackgroundTaskLocalServiceImpl.amendBackgroundTask(BackgroundTaskLocalServiceImpl.java:163)
      at sun.reflect.GeneratedMethodAccessor542.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:153)
      at com.liferay.portal.spring.transaction.DefaultTransactionExecutor.execute(DefaultTransactionExecutor.java:85)
      at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:58)
      at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:127)
      at com.liferay.portal.service.ServiceContextAdvice.invoke(ServiceContextAdvice.java:40)
      at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:127)
      at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
      at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:127)
      at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:173)
      at com.sun.proxy.$Proxy351.amendBackgroundTask(Unknown Source)
      at com.liferay.portal.background.task.internal.BackgroundTaskManagerImpl.amendBackgroundTask(BackgroundTaskManagerImpl.java:124)
      at com.liferay.portal.background.task.internal.messaging.BackgroundTaskMessageListener.doReceive(BackgroundTaskMessageListener.java:73)
      at com.liferay.portal.kernel.messaging.BaseMessageListener.receive(BaseMessageListener.java:26)
      ... 5 more
      Caused by: com.liferay.portal.kernel.dao.orm.ORMException: {mvccVersion=0, backgroundTaskId=30901, groupId=0, companyId=0, userId=0, userName=, createDate=Mon Mar 21 16:58:57 GMT 2016, modifiedDate=Mon Mar 21 17:03:18 GMT 2016, name=reindexOnActivate#com.liferay.portal.kernel.plugin.PluginPackage, servletContextNames=, taskExecutorClassName=com.liferay.portal.search.internal.background.task.ReindexSingleIndexerBackgroundTaskExecutor, taskContextMap={deleteOnSuccess=true, className=com.liferay.portal.kernel.plugin.PluginPackage, companyIds=[J@780f9040, threadLocalValues={defaultLocale=en_US, clusterInvoke=true, groupId=0, principalName=null, siteDefaultLocale=null, companyId=20202, themeDisplayLocale=null}}, completed=false, completionDate=null, status=1, statusMessage=} is stale in comparison to {mvccVersion=1, backgroundTaskId=30901, groupId=0, companyId=0, userId=0, userName=, createDate=2016-03-21 16:58:57.487, modifiedDate=2016-03-21 16:58:57.487, name=reindexOnActivate#com.liferay.portal.kernel.plugin.PluginPackage, servletContextNames=, taskExecutorClassName=com.liferay.portal.search.internal.background.task.ReindexSingleIndexerBackgroundTaskExecutor, taskContextMap={deleteOnSuccess=true, className=com.liferay.portal.kernel.plugin.PluginPackage, companyIds=[Ljava.lang.Integer;@39f17ce3, threadLocalValues={defaultLocale=en_US, groupId=0, clusterInvoke=true, principalName=null, siteDefaultLocale=null, companyId=20202, themeDisplayLocale=null}}, completed=false, completionDate=null, status=0, statusMessage=}
      at com.liferay.portal.dao.orm.hibernate.ExceptionTranslator.translate(ExceptionTranslator.java:46)
      at com.liferay.portal.dao.orm.hibernate.SessionImpl.merge(SessionImpl.java:245)
      at com.liferay.portal.kernel.dao.orm.ClassLoaderSession.merge(ClassLoaderSession.java:410)
      at com.liferay.portal.background.task.service.persistence.impl.BackgroundTaskPersistenceImpl.updateImpl(BackgroundTaskPersistenceImpl.java:8503)
      ... 25 more
      Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): com.liferay.portal.background.task.model.impl.BackgroundTaskImpl#30901
      at org.hibernate.event.def.DefaultMergeEventListener.entityIsDetached(DefaultMergeEventListener.java:485)
      at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:255)
      at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:84)
      at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:867)
      at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:851)
      at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:855)
      at com.liferay.portal.dao.orm.hibernate.SessionImpl.merge(SessionImpl.java:242)
      ... 27 more

        Attachments

          Activity

            People

            • Assignee:
              support-lep@liferay.com SE Support
              Reporter:
              william.newbury William Newbury
              Participants of an Issue:
              Recent user:
              Melody Wu
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Days since last comment:
                3 years, 34 weeks, 6 days ago

                Packages

                Version Package