How to cancel a hang task in vCenter or ESXi host?

By | November 14, 2017

Recently my customer wanted to cancel a "creating a snapshot" task. The task was created by backup application. Unfortunately the cancel option was greyed so wow to cancel it? I will show this in the following post.

At first you have to investigate where a hang process exists (Clicking summary tab on VM). Then:

  1. Log in to ESXi host via SSH (using e.g. putty). If the SSH service is not running on ESXi host, please enable it.

To enable SSH from the vSphere Client:

  • Select the host and click the Configuration tab.
  • Click Security Profile in the Software panel.
  • In the Services section, click Properties.
  • Select SSH and click Options.
  • Change the SSH options.
  • Click OK.
  1. Run ps command. If you face problems to find the running processes related to the VM please use grep e.g. ps | grep VM_name. In the below example, I looked for VM named: SPDB1CEN-T:kill_task
  2. Kill the parent process by running the command kill id_parent. In my case: kill 84695.
  3. The hang task should be canceled now.

It is also possible just to reboot ESXi host (after doing vMotion of other VMs) to solve the issue.

Note: Please follow snapshots best practices and recommendations to avoid problems with them and how to delete snapshots automatically.

Update: You can try the below options:

  1. Log in to ESXi host via ssh.
  2. Run esxcli vm process list to get world id of VM.
  3. Power off the virtual machine from the list by running this command: esxcli vm process kill --type= [soft,hard,force] --world-id= WorldNumber
Author: Mariusz

Architect (~ 15 years experience based on passion...) with strong background as a System Administrator and Engineer. Focused on Data Center Solutions: Virtualization/Cloud Computing and Storage/Backup Systems. Currently living in Poland.

6 thoughts on “How to cancel a hang task in vCenter or ESXi host?

  1. Anthony Junk

    Do not do this, this is a horrible suggestion without at least caveating what it does. The above command in step 3 will kill the VM -- stop it cold. This will likely corrupt most systems and should only be done if you either are: 1) planning to restore from backup or 2) want to get rid of the vm anyways.

    1. Robert

      Hi Anthony,

      I am experiencing the same issue.
      Is there a safe way to kill the task via esxcli in this exact senior without killing the VM?


  2. Durgesh

    esxcli vm process kill --type= [soft,hard,force] --world-id= WorldNumber

  3. Charvo Benjamin

    I have similar issue, no task running on ESXi but vcenter showing power on VM. Once way is restart vcenter or vcenter services.

    Is there any way kill task without restart

  4. Jimmy Chantani

    You can also clear the tasks by powering down your VM. Rebooting would not cancel the hung up tasks.

    I was looking for a way to avoid shutting down my VM. I thought this was going to help, but NO. kill id_parent would definitely power down your VM without a warning.

    Please post if you find a better way.


Leave a Reply

Your email address will not be published.

one × 2 =