Salesforce

WorldServer - how to send a Task hanging in the Workflow Engine Queue into Autoerror

« Go Back

Information

 
Article TypeSolution Article
Scope/EnvironmentWorldServer
Symptoms/Context
I see one or more Task hanging in the Workflow Engine Queue only (not in the Filter Engine Queue) for a long time. Sometimes the status is Pending, On Queue and sometimes it is Executing.

It looks like it is stuck and not completing. What can be done?
Resolution
Starting from version 11.8.1, a new button has been introduced in the Workflow Engine Queue which will send tasks into Autoerror.

To learn more about this feature in version 11.8.1, please read this article:

WorldServer - about the button "Send to Auto Error" in the Workflow Engine Queue page, introduced in version 11.8.1

In earlier versions (up to version 11.8.0), please read below.

Check if there are Deadlocks in the Database and kill them. Possibly, that might solve the issue. Often, deadlocks are not the issue, in which case, proceed as below:

In the Workflow Engine Queue, you have the option to select a Job (Task) and cancel it using the Cancel button.

User-added image

However, if you use the Cancel button in the Workflow Engine Queue page, the Task will be canceled completely. In many cases, customers do not want to cancel a task, they want it to proceed. The only way to address this is if we can make the Task jump the current step or set it into Autoerror. Once in Autoerror, the Task can be completed. WorldServer will then attempt to repeat the same step, mostly successfully.

1- If the Tasks hang in Save or Save target in PENDING (not Executing) status it means that the GENERATE has actually already been done, but for some reason, WorldServer is not completing the step. To make it jump to the next step, apply this article:

A Workflow Task remains in 'Pending' state indefinitely in the Workflow Engine Queue on "Save" workflow step

2- if the Tasks hang in a different step and also in Executing status as in this example:

User-added image

first, try to restart the workflow engines using ws_gate as described here:

How to restart the Workflow Engine via ws_gate in WorldServer

or restart the Idiom Service.

3- If #2 does not work and the job is still hanging in Executing or On Queue status after the restart, use the spMoveProjecttasktoAutoError stored procedure to send the job/task into Autoerror, which will allow you to complete the Autoerror. The step will be repeated, most of the time successfully.

IMPORTANT: in order to run the stored procedures below, you will need to first load the stored procedure first in the Database. This action should be done by an experienced Database Administrator and is at your own risk. This article provides the stored procedures that you should load to be able to apply this workaround:

WorldServer - stored procedure for SQL and Oracle Databases to be able to send long-running, executing jobs in the workflow Engine into Autoerror

Once the stored procedure is loaded in your WorldServer Database, this is the syntax of the query that you can run to send the hanging Job into Autoerror (example):

Query 1:

exec spMoveProjecttasktoAutoError (232561, 1)  (for Oracle Database, remember to commit)
exec spMoveProjecttasktoAutoError 232561,1  (for SQL Database)

Note:
the first number (in this example, 232561) stands for the project ID. The second number stands for the Task number (not ID). So make sure to find the correct project ID (not project group ID) and the Task number and enter them in the query. The Task number displays in the Workflow Engine Queue and in the Project's Tasks page. Here is an example:

User-added image

In case you do not know the project ID, click on the project's name. The project's page will open up, where you will also see the Task hanging. In the URL, you will easily find the project ID. For example:

https://worldserver.com/ws-legacy/assignments_tasks?&token=1951544935&project=232561

Query 2 (same as one, different syntax):
 
USE [ECL-US1-WS003_WS]
GO

DECLARE    @return_value int

EXEC    @return_value = [dbo].[spMoveProjecttasktoAutoError]
        @vInProjectId = 21659,
        @vInTaskNuminProject = 19

SELECT    'Return Value' = @return_value

GO

3- Third method to run the query:  in the Database, right click on the Stored Procedure, select Execute stored procedure... and then enter the project ID and the Task number. Example:

User-added image

4- Once you run the query successfully and with any of the 3 methods above in the Database, the Tasks will go into Autoerror and you will have a chance to complete the error, which will re-do the action. If there are multiple Tasks that you have sent into Autoerror, complete them one by one and monitor them to make sure they complete successfully this time.

5- In some cases, after completion of the Autoerror, the Tasks do not execute but remain On Queue. In that case, restart WorldServer (Idiom) and then monitor the Workflow Engine queue for completion. Possibly, some tasks are still in Autoerror and need to be completed again.
Root Cause
Possible, there have been a database connection issue while the job was running. This led to tasks/jobs hanging in the Workflow Engine queue and not completing. In some cases, deadlocks can be found in the Database. 
Reference
Attachment 1 
Attachment 2 
Attachment 3 
Attachment 4 
Attachment 5 

Powered by