Legacy Knowledge Base
Published Jul. 2, 2025

Staging tasks do not start and remain at 0%

Written By

David Tello

How To articles are not official guidelines or officially supporteddocumentation. They are community-contributed content and may not alwaysreflect the latest updates to Liferay DXP. We welcome your feedback toimprove How to articles!

While we make every effort to ensure this Knowledge Base is accurate, itmay not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with anyfeedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack"publication program, made available for informational purposes. Articlesin this program were published without a requirement for independentediting or verification and are provided "as is" withoutguarantee.

Before using any information from this article, independently verify itssuitability for your situation and project.

NOTE: This article is an INTERNAL article and is not visible to customers, currently. Please only link this article in internal comments, but not public comments.

Issue

  • When you try to publish live some content (web content, page, etc.) and create a new task, the publication task gets stuck and never starts.
  • The progress of the task always remains at 0%.

Environment

  • DXP 7.3
  • DXP 7.2

Resolution

  • In some cases this situation could be produced because a com.liferay.exportimport.internal.background.task.LayoutStagingBackgroundTaskExecutor background task has a lock in the database.
  • Only one task of each type can be executed at a time, and if there is a lock in the one that should be executed, the rest should wait too.
  • A node crashes or an unordered shutdown could produce this situation.
  • When this happens, there is a row in the Lock_ table that should be removed. To remove this problematic row easily, the following script could be useful:
    import com.liferay.portal.kernel.model.*;
    import com.liferay.portal.kernel.service.*;
    import com.liferay.portal.background.task.service.*;
    import com.liferay.portal.kernel.backgroundtask.*;
    import com.liferay.portal.lock.service.*;
    
    
    String taskExecutorClassNametaskExecutorClassName = "com.liferay.exportimport.internal.background.task.LayoutStagingBackgroundTaskExecutor";
    
    String groupId = "3172392";
    
    String lockKey = taskExecutorClassName + "#" + groupId;
    
    boolean isLocked = LockLocalServiceUtil.isLocked(BackgroundTaskExecutor.class.getName(), lockKey);
    
    if(isLocked) {
        LockLocalServiceUtil.unlock(BackgroundTaskExecutor.class.getName(), lockKey);
        out.println("Unlocking " + lockKey);
    }
    
    def backgroundTask = BackgroundTaskLocalServiceUtil.fetchFirstBackgroundTask(
    taskExecutorClassName, BackgroundTaskConstants.STATUS_QUEUED);
    
    while (backgroundTask != null)
    {
        out.println("Cancelling " + backgroundTask.getBackgroundTaskId());
        BackgroundTaskLocalServiceUtil.amendBackgroundTask(
            backgroundTask.getBackgroundTaskId(), null, BackgroundTaskConstants.STATUS_CANCELLED,
            "Cancelled", new ServiceContext());
    
        backgroundTask = BackgroundTaskLocalServiceUtil.fetchFirstBackgroundTask(
            taskExecutorClassName, BackgroundTaskConstants.STATUS_QUEUED);
    }
  • This script works with local staging. If you are using remote staging, you should change the initiation of the variable taskExecutorClassName from "com.liferay.exportimport.internal.background.task.LayoutStagingBackgroundTaskExecutor" to "com.liferay.exportimport.internal.background.task.LayoutRemoteStagingBackgroundTaskExecutor".

Additional Information

 

Did this article resolve your issue ?

Legacy Knowledge Base