Articles in this section

How to cancel a stuck task in Plesk

kb: how-to Plesk for Linux ABT: Group B

Applicable to:

  • Plesk for Linux
  • Plesk for Windows

Question

A task (scheduled task, WordPress installation, extension update, etc.) is stuck in Plesk. How to stop this stuck task and close the "tasks in progress" window?


2017_09_19_03_42_39_example.com_Plesk_Onyx_17.0.17.png
 

Answer

Plesk for Linux
  1. Connect to your Plesk server via SSH.
  2. Create a backup of the Plesk database:

    # plesk db dump > /root/psa_dump_for_kb_12377460333463.sql

  3. Find the stuck process:

    # plesk db "SELECT id,type,status,finishTime FROM longtasks WHERE status <> 'done'"

    +----+-----------------------------+---------+---------------------+
    | id | type                        | status  | finishTime          |
    +----+-----------------------------+---------+---------------------+
    | 56 | ext-wp-toolkit-task\install | started | 0000-00-00 00:00:00 |
    +----+-----------------------------+---------+---------------------+

  4. Delete the task from the longtasks table using id from step 3:

    # plesk db "DELETE FROM longtasks WHERE id=56"

  5. Delete entries from the longtaskparams table using id from step 3:

    # plesk db "DELETE FROM longtaskparams WHERE task_id=56"

    • If there are several stuck tasks that have to be cancelled, run the commands below to delete them:

      # plesk db -Ne "SELECT id FROM longtasks WHERE status <> 'done'" | while read i; do plesk db "DELETE FROM longtaskparams WHERE task_id=$i" ; done

      # plesk db "DELETE FROM longtasks WHERE status <> 'done'"

  6. Stop the process that manages the stuck task:

    # pkill task-async-executor

     

    In case new tasks keep getting stuck in Plesk after performing the above actions, clear the lock manager using the command:

    # systemctl stop sw-engine && rm -rf /var/lock/lmlib/container_locks/* && rm -f /usr/local/psa/var/cache/* && systemctl start sw-engine

Plesk for Windows Server
  1. Connect to your Plesk server via RDP.
  2. Start a command prompt as an Administrator.
  3. Create a backup of the Plesk database:

    C:\> plesk db dump > C:\psa_dump.sql

  4. Find the stuck process:

    C:\> plesk db "SELECT id,type,status,finishTime FROM longtasks WHERE status <> 'done'"

    +----+-----------------------------+---------+---------------------+
    | id | type                        | status  | finishTime          |
    +----+-----------------------------+---------+---------------------+
    | 56 | ext-wp-toolkit-task\install | started | 0000-00-00 00:00:00 |
    +----+-----------------------------+---------+---------------------+

  5. Delete the task from the longtasks table using id from step 4:

    C:\> plesk db "DELETE FROM longtasks WHERE id=56"

  6. Delete entries from the longtaskparams table using id from step 4:

    C:\> plesk db "DELETE FROM longtaskparams WHERE task_id=56"

 

Was this article helpful?

Comments

4 comments
Date Votes
  • thank you so much for sharing 

    0
  • This ensured I could remove the stuck task from the queue, but when I go to run the task again (ie: remove a subscription), it just gets stuck again... tried the steps to clear the lock manager, but no difference :(

    0
  • I have done all the steps, but I still have problems

    Thanks for your help

    1
  • # pkill task-async-executor

    produced the following error message on ubuntu 24.04:

    pkill: pattern that searches for process name longer than 15 characters will result in zero matches
    Try `pkill -f' option to match against the complete command line.

    Other than that, it was definitely helpful and to the point.

    0

Please sign in to leave a comment.