This article describes an issue where a scheduled job gets stuck running and fails to run properly moving forward. The article will provide steps to resolve the issue.
Note: If this site is on DXC, the customer will have to engage a managed service resource to assist in executing steps below.
For the case of discussion we will use the "Automatic Emptying of Trash" job as an example.
1. Identify the name of the scheduled job that is stuck running. The Name of the job exists in the database.
2. All scheduled jobs appear in the CMS database in the dbo.tblScheduledItem table. The Name column is the actual name of the job.
SELECT * from dbo.tblScheduledItem
WHERE Name = 'Automatic Emptying of Trash'
3. A resource with database access will have to mark the job as stopped and disabled with one of the the following scripts.
Note: isRunning is the job running and Enabled is if it is marked to auto run on a schedule.
UPDATE dbo.tblScheduledItem
SET IsRunning = 0, Enabled = 0
WHERE Name = 'Automatic Emptying of Trash'
4. A resource with web application access will restart the web application that is executing the scheduled job and CMS. These could be one in the same.
5. The customer confirms the job is not running by checking in the CMS in the Scheduled Job section.
6. The customer can then run the job once manually to confirm it works.
7. Once that manual job completes, the customer will re enable the scheduled job in the CMS.
Comments
2 comments
Alternatively some people use the pkId in the row to accomplish the same thing, if you have a pkID.
UPDATE dbo.tblScheduledItem
SET IsRunning = 0, Enabled = 0
WHERE pkID in 'PUT YOUR PKID HERE '
This shouldn't happen if the job is developed correct, it should be "stoppable" and "restartable".
See https://world.episerver.com/blogs/Sergey-Vorushilo/Dates/2017/12/scheduled-jobs-setup-in-dxc-service/
"When developing a scheduled job for a site hosted in DXC-S, it is important to define the job as stoppable - set the IsStoppable property to true and implement the Stop method. This will give a chance for your job to perform a graceful shutdown when the web worker instance is recycled during jobs execution. Another important consideration, especially for the long-running jobs and jobs processing massive amounts of data, is to configure the job as Restartable. This will tell the scheduler service to start the job again if the job was shut down during the previous execution. It’s up to the jobs implementation to store some checkpoint to be able to resume the processing when restarted. "
Please sign in to leave a comment.