Why a cancelled task is still on the list?

Hello, elastic!

While running multiple msearch API through Java clients, I found one of the tasks took abnormally long.
So I executed Task Cancel API, but it doesn't seem cleanup properly.
When I check the task via Task API, it shows cancelled: true, cancellable: true, completed: false and running time is still increasing.
I know it doesn't work right away, however, it has been almost a day.
Now, I need to figure it out what should I do in this situation.

My question is:

  1. Why cancelled task (cancelled: true) is still on the list? Do I need to keep waiting?
  2. What could be the solution for this situation? delete the task forcibly? reboot server? force merge? etc
  3. Does DELETE .tasks/task/_doc/<yourtaskid> delete a specific task? and is there no side effects?
    (How to delete a task in Elasticsearch v7.14 - #7 by stephenb)
  4. Is there anything more I can check?

Thank you in advance!

Hello,

What is your Elasticsearch version? You didn't mention it.

sorry for that. It is 7.10!

7.10 is pretty old and no more supported.

I don't think that there is much that you can do, I would suggest that you try to restart the node where the task is running to see if this solve this issue.

You should also upgrade.

Is there any solution if I upgrade to 8.8 and face the same problem?

I think this is a bug. Possibly it's been fixed already in the couple of years since 7.10 was released, but if you can reproduce it in a supported version then I would like to investigate further.

Unfortunately, it is barely possible to upgrade the current version in my situation.

Anyway..
After rebooting the nodes, the deadlock task on the list has been removed for now.
I will let you know, when I face the same problem again.

Thanks for helping!