Issue #3817
closedTask assigned to the resource manager not cancel when it stops
Description
When stopping resource manager worker, tasks that assigned to the resource manager will not be cancelled and leaving the tasks in "Waiting" state forever. This is because the "worker_name" of the TaskStatus is not set during the creation and Pulp is unable to find the tasks for the resource manager during the worker cleanup.
Below is how I reproduce it.
1) Stop the all pulp workers and leave only pulp resource manager running.
2) Trigger a regenerate applicability for consumers task
3) Check the Qpid stat and I saw 1 message.
- qpid-stat -q -b amqps://localhost:5671
Queues
queue dur autoDel excl msg msgIn msgOut bytes bytesIn bytesOut cons bind
==================================================================================================================================================
resource_manager Y 1 1 0 1.36k 1.36k 0 1 2
4) Stop resource manager. 'systemctl stop pulp_resource_manager' and I saw the message is dequeued
Queues
queue dur autoDel excl msg msgIn msgOut bytes bytesIn bytesOut cons bind
================================================================================================================================
resource_manager Y 0 1 1 0 1.36k 1.36k 0 2
5) Check the task and I saw the task is still in "Waiting" state.
pulp_tasks:
- exception:
task_type: pulp.server.managers.consumer.applicability.regenerate_applicability_for_consumers
_href: "/pulp/api/v2/tasks/7885eaad-7563-4814-981a-b6e23cf459c4/"
task_id: 7885eaad-7563-4814-981a-b6e23cf459c4
tags:
- pulp:action:consumer_content_applicability_regeneration
finish_time:
_ns: task_status
start_time:
traceback:
spawned_tasks: []
progress_report: {}
queue: None.dq
state: waiting
worker_name: