Unable to remove stale queued tasks from the vCenter "Recent Tasks"
search cancel

Unable to remove stale queued tasks from the vCenter "Recent Tasks"

book

Article ID: 420691

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

  • The queued tasks remains as stale task in vCenter servers task list.
  • These tasks are not getting cleared after the restart of vpxd and vsphere-ui service. 
  • The Managed Object Browser (MOB) Task Manager will not show the queued task when checking it from vCenter MOB Task Manager - https://vcenter_FQDN>/mob/?moid=TaskManager 

Environment

vCenter server 7.x

vCenter server 8.x

Cause

Some of the queued task entries are left on vCenter server database without having task name in the table vpx_task however the task entries are remains with the database with task_id. 

Resolution

The first method to clear a stuck task is to restart the vsphere-ui and vpxd services as mentioned in this KB article: Clear stale tasks from the vCenter "Recent Tasks" panel

 If the queued tasks still remain in vCenter server recent tasks then follow below given steps to remove queued stale tasks from vCenter Server Database(VCDB).   

  • SSH to the vCenter Server Appliance as root.

  • Stop the vpxd service:
       service-control --stop vpxd

  • Connect to the VCDB:
         /opt/vmware/vpostgres/current/bin/psql -d VCDB -U postgres

  • Identify the queued tasks: 
          SELECT * FROM vpx_task WHERE complete_state NOT IN('success','error');
  • Delete the queued tasks by typing task_id hence the name of task might be empty. 

          DELETE FROM vpx_task WHERE task_id IN (task_id1, task_id2, task_id3);
  • Quit the database console:

           VCDB=# \q

  • Start the vpxd service:

           service-control --start vpxd
  • Refresh the browser console and verify the tasks are cleared in the vSphere Client.


Note: Please ensure availability of vCenter server snapshot before interact with the VCDB. 
          Refer: Snapshot Best practices for vCenter Server Virtual Machines