Hello guys,
You will find today's post more interesting because resolution of this issue is only documented as vcloud service restart. There are many posts on the web which says that in order to clean the stuck job in VMware Cloud Director GUI, you need to restart vCD services.
Today, I faced the same issue but I decided to find some other solution. For single VM, it is never a good idea to restart entire vcloud director services. isn't it?
Issue : Task is running since long in Cloud Director GUI and not timing out even after more than 6 hours
First, let me show you what exactly a long running job or stuck job means. Below is the task detail. In vCloud Director GUI, you will also see that particular tasks is running since long. Hope it is clear
Observation : Above job was running since last 6-7 hours. Earlier, I noticed that such job used to timed-out in around 4 hours which is default time out value for any vcd tasks but this one was stubborn job. Due to this, I couldn't perform any operation on VM other than power off and power on. From vCenter, there was no such issues so this was clearly a VMware Cloud Director issue
Solution :
1. Login primary cell with root account and then login DB (if embedded. In case of external DB then login directly DB server).
2. Run below command to see the stuck task
select * from organization where name = 'org_name';
It will give you org_id. note that down.
3. Now run below command by using org_id you got in 2nd command.
select * from task where org_id = 'org_id';
It will show you the task name, job id (as in above snippet), which will confirm that this is the right task to cancel. Generally you will see this stuck task only but if you see many then search with job id rather than org_id. If you don't understood this line then, comment box is yours.
4. Now execute below command to delete this task from DB. Take backup first please!
Delete from task where org_id = 'org_id';
Stuck task has been deleted from DB now. Doing all above operations doesn't require any downtime so go ahead without any fear!
Cheers!