Software Jobs Stuck in Terminating State

Document ID : KB000098374
Last Modified Date : 29/05/2018
Show Technical Document Details
Issue:
Software jobs are stuck in the "terminating" state.
Environment:
Client Automation (ITCM) -- any version.
Cause:
Most commonly, the issue is caused simply by the System Delivery Engine (aka Software Delivery Task Manager process) is not running, and therefore not processing tasks.  Less commonly, there is a scenario, as part of the job container termination process, where the Task Manager is waiting indefinitely for a reply from the Data Transport Service (DTS), that all transfers associated with the job container have been cleaned up.  When Task Manager does not receive a reply, it may wait indefinitely, leaving the job in a terminating state.
Resolution:
Firstly, you should always try simply recycling CAF:
# caf stop
# caf start


If a simple CAF recycle does not resolve, then you can use the following database script to delete any container stuck in the terminating state:

Note: Ensure CAF is stopped prior to running this script!

declare @var_objectid varchar(50)
declare job_delete cursor for

select objectid from usd_job_cont where state=8 and objectid in (select jobcont from usd_jcview) and objectid in (select jcchild from usd_link_jc) and objectid in (select jcont from usd_link_jc_act)

open job_delete
fetch job_delete into @var_objectid
while (@@fetch_status=0)
begin
  delete usd_jcview where jobcont=@var_objectid
  delete usd_link_jc where jcchild=@var_objectid
  delete usd_link_jc_act where jcont=@var_objectid
  delete usd_cc where objectid=@var_objectid
  delete usd_job_cont where objectid=@var_objectid
fetch job_delete into @var_objectid
end

close job_delete
deallocate job_delete
go