Salesforce

WorldServer - after being canceled, Tasks/Jobs remain in 'To be canceled' status in the Workflow Engine Queue or in the Background Jobs

« Go Back

Information

 
Article TypeSolution Article
Scope/EnvironmentWorldServer
Symptoms/Context
Some Jobs/Tasks were canceled from the Workflow Engine Queue. Instead of simply disappearing from the Workflow Engine Queue and also instead of displaying as Canceled in the project's tasks page, those Tasks remain in status To Be Canceled.

In some cases, these tasks/jobs block other jobs from being processed and they remain "In queue":

User-added image


The same issue might happen after cancelling jobs from the Background Jobs page.
Resolution

There are 2 different approaches depending on whether the issue happens in the Workflow Engine Queue page or in the Background Jobs page. Follow the instructions below.


If the issue happens in the Workflow Engine Queue:


1-If the To Be Canceled jobs are the same or higher priority, in the database, you can change the priority below the other tasks that need to execute.
select * from TASKS where PROJECTID = yyyyy
Find the task in the project in the UI that is in the To Be Canceled state
update TASKS set PRIORITY = 4 where TASKID = zzzzz

Restart the Workflow Engine Queue via ws_gate (if available).  Follow the steps in this article:

How to restart the Workflow Engine via ws_gate in WorldServer

Then change the status of the To Be Canceled jobs in the database to Canceled:
select TASKID, PROJECTID, PROJECTGROUPID, STATUS, COMPLETIONSTATUS, TASKAUTOSTEPSTATE, TASKNUMINPROJECT 
from TASKS where PROJECTID=xxxxxx

Find the task in the project in the UI that is in the To Be Canceled state and update that taskid's taskautostepstate=0
update TASKS set TASKAUTOSTEPSTATE = 0 where TASKID = YYYYYY

However, this does not always work.

2- If #1 doesn't work, to remove those Jobs from the Workflow Engine queue and move them to canceled status, an Idiom restart needs to be done. After  Idiom restart, the To Be Canceled status will disappear, the jobs/tasks will not be visible in the Workflow Engine Queue anymore and those tasks will have the status Canceled in the Tasks page as expected.

3- If steps #1 and #2 remain unsuccessful and those jobs in To Be Canceled status do not go away after Idiom restart, the only way is to remove them from the Database as explained in this article

How to delete Projects or Tasks from a Worldserver Database
 

If the issue happens in the Background Jobs page

where a Job remains in To Be Canceled and does not complete, use the Job ID corresponding to the Job and run this query in the Database to send the job to status On Hold (STATUS=3). The BACKGROUNDTASKID corresponds to the Job ID column.
 
update BACKGROUNDTASKS set STATUS=3 where BACKGROUNDTASKID=6718115

Once the query as been run, refresh the Background Jobs page: that Job will now be in status On Hold. Resume it and the cancellation will be completed. Unfortunately it is not possible to change the status of a To Be Canceled jobs from the User Interface, which is why we do this in the Database.
 
Root Cause

Unknown.
Reference
Attachment 1 
Attachment 2 
Attachment 3 
Attachment 4 
Attachment 5 

Powered by