Project

Profile

Help

Issue #7389

closed

Cancelled tasks are processed by worker

Added by osapryki over 3 years ago. Updated over 3 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Sprint 81
Quarter:

Description

If task is in queue and cancelled before being picked up by resource-manager, it may be still scheduled to a worker and processed.

Steps to reproduce.

  1. Start API service. Worker and resource-manager are not running.
  2. Trigger a task by calling enqueue_with_reservation().
  3. Cancel task via API:
curl -u admin:admin -XPATCH -H 'Content-Type: application/json' -d '{"state": "canceled"}' 'http://localhost:5001/pulp/api/v3/tasks/9e9009ea-e95c-40ff-870e-09219db62a05/'
  1. Verify that task is in cancelled state.
  2. Start worker and resource manager.

Actual result:

The task is assigned to worker and is executed with the following warning message logged:

worker_1            | pulp: pulpcore.app.models.task:WARNING: Task __call__() occurred but Task 9e9009ea-e95c-40ff-870e-09219db62a05 is not at WAITING
worker_1            | pulp: rq.worker:INFO: 1@ee04748f4846: Job OK (9e9009ea-e95c-40ff-870e-09219db62a05)
worker_1            | pulp: rq.worker:INFO: 1@ee04748f4846: pulpcore.tasking.tasks._release_resources('9e9009ea-e95c-40ff-870e-09219db62a05') (49d580eb-e483-4df8-b520-296d28fd5185)
worker_1            | pulp: rq.worker:INFO: 1@ee04748f4846: Job OK (49d580eb-e483-4df8-b520-296d28fd5185)

After the task is finished it changes it's state to completed.

Expected result:

Task is not executed.

Also available in: Atom PDF