[GH-ISSUE #390] [BUG] Deadline of active task is invalid #173

Closed
opened 2026-03-02 05:19:19 +03:00 by kerem · 6 comments
Owner

Originally created by @nkbai on GitHub (Jan 28, 2022).
Original GitHub issue: https://github.com/hibiken/asynq/issues/390

Originally assigned to: @hibiken on GitHub.

Describe the bug
asynqapi/queues/default/active_tasks?page=1&size=20
returns:

{
  "tasks": [
    {
      "id": "315f4ee3-98e2-4f11-8f95-5e816aa48a38",
      "type": "tasktype",
      "payload": "{\"TaskId\":\"664337037462486623\"}",
      "queue": "default",
      "max_retry": 1,
      "retried": 0,
      "error_message": "",
      "start_time": "-",
      "deadline": "-"
    },
    {
      "id": "210c0350-9856-4096-8d7b-88b79caa2a6d",
      "type": "tasktype",
      "payload": "{\"TaskId\":\"664336607550895997\"}",
      "queue": "default",
      "max_retry": 1,
      "retried": 0,
      "error_message": "",
      "start_time": "-",
      "deadline": "-"
    },
    {
      "id": "4c66a334-2095-4e14-a27d-ad0bf8508d36",
      "type": "tasktype",
      "payload": "{\"TaskId\":\"664337044687464370\"}",
      "queue": "default",
      "max_retry": 1,
      "retried": 0,
      "error_message": "",
      "start_time": "-",
      "deadline": "-"
    },
    {
      "id": "9acbd57f-c561-4ca5-9438-17e0325a2689",
      "type": "tasktype",
      "payload": "{\"TaskId\":\"664337353919168030\"}",
      "queue": "default",
      "max_retry": 1,
      "retried": 0,
      "error_message": "",
      "start_time": "2022-01-28T12:39:01Z",
      "deadline": "2022-01-28T12:40:01Z"
    }
  ],
  "stats": {
    "queue": "default",
    "memory_usage_bytes": 0,
    "size": 6,
    "active": 4,
    "pending": 0,
    "scheduled": 0,
    "retry": 0,
    "archived": 2,
    "processed": 15,
    "succeeded": 11,
    "failed": 4,
    "paused": false,
    "timestamp": "2022-01-28T20:39:05.501853+08:00"
  }
}

I've the same problem with #286. and I'm sure that (r *recoverer) recover() is called every miniute.

redis-cli lrange asynq:{default}:active 0 -1                                                            
1) "4c66a334-2095-4e14-a27d-ad0bf8508d36"
2) "315f4ee3-98e2-4f11-8f95-5e816aa48a38"
3) "210c0350-9856-4096-8d7b-88b79caa2a6d"

list deadline returns these ids ,but their deadline is invalid. so r.broker.ListDeadlineExceeded(deadline, r.queues...) returns empty.

Originally created by @nkbai on GitHub (Jan 28, 2022). Original GitHub issue: https://github.com/hibiken/asynq/issues/390 Originally assigned to: @hibiken on GitHub. **Describe the bug** asynqapi/queues/default/active_tasks?page=1&size=20 returns: ```json { "tasks": [ { "id": "315f4ee3-98e2-4f11-8f95-5e816aa48a38", "type": "tasktype", "payload": "{\"TaskId\":\"664337037462486623\"}", "queue": "default", "max_retry": 1, "retried": 0, "error_message": "", "start_time": "-", "deadline": "-" }, { "id": "210c0350-9856-4096-8d7b-88b79caa2a6d", "type": "tasktype", "payload": "{\"TaskId\":\"664336607550895997\"}", "queue": "default", "max_retry": 1, "retried": 0, "error_message": "", "start_time": "-", "deadline": "-" }, { "id": "4c66a334-2095-4e14-a27d-ad0bf8508d36", "type": "tasktype", "payload": "{\"TaskId\":\"664337044687464370\"}", "queue": "default", "max_retry": 1, "retried": 0, "error_message": "", "start_time": "-", "deadline": "-" }, { "id": "9acbd57f-c561-4ca5-9438-17e0325a2689", "type": "tasktype", "payload": "{\"TaskId\":\"664337353919168030\"}", "queue": "default", "max_retry": 1, "retried": 0, "error_message": "", "start_time": "2022-01-28T12:39:01Z", "deadline": "2022-01-28T12:40:01Z" } ], "stats": { "queue": "default", "memory_usage_bytes": 0, "size": 6, "active": 4, "pending": 0, "scheduled": 0, "retry": 0, "archived": 2, "processed": 15, "succeeded": 11, "failed": 4, "paused": false, "timestamp": "2022-01-28T20:39:05.501853+08:00" } } ``` I've the same problem with #286. and I'm sure that `(r *recoverer) recover() ` is called every miniute. ```bash redis-cli lrange asynq:{default}:active 0 -1 1) "4c66a334-2095-4e14-a27d-ad0bf8508d36" 2) "315f4ee3-98e2-4f11-8f95-5e816aa48a38" 3) "210c0350-9856-4096-8d7b-88b79caa2a6d" ``` list deadline returns these ids ,but their deadline is invalid. so ` r.broker.ListDeadlineExceeded(deadline, r.queues...)` returns empty.
kerem 2026-03-02 05:19:19 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@hibiken commented on GitHub (Jan 28, 2022):

@nkbai thank you for reporting this issue!

Can you also provide the output of redis-cli zrange asynq:{default}:deadlines 0 -1 withscores?

<!-- gh-comment-id:1024238936 --> @hibiken commented on GitHub (Jan 28, 2022): @nkbai thank you for reporting this issue! Can you also provide the output of `redis-cli zrange asynq:{default}:deadlines 0 -1 withscores`?
Author
Owner

@nkbai commented on GitHub (Jan 29, 2022):

redis-cli zrange asynq:{default}:deadlines 0 -1 withscores

  1. "2aa19466-a99f-4553-b552-f9b6232946f7"
  2. "1643420787"
<!-- gh-comment-id:1024803278 --> @nkbai commented on GitHub (Jan 29, 2022): redis-cli zrange asynq:{default}:deadlines 0 -1 withscores 1) "2aa19466-a99f-4553-b552-f9b6232946f7" 2) "1643420787"
Author
Owner

@nkbai commented on GitHub (Jan 29, 2022):

after set task's defaultTimeout to 1 minute ,this task is send to archived after several minutes. but I want to try this task even the asynq is killed by kill -9.

<!-- gh-comment-id:1024805712 --> @nkbai commented on GitHub (Jan 29, 2022): after set task's `defaultTimeout` to 1 minute ,this task is send to archived after several minutes. but I want to try this task even the asynq is killed by `kill -9`.
Author
Owner

@hibiken commented on GitHub (Jan 29, 2022):

I see. thank you for providing the info! It seems like the task IDs are in the active set but not in the deadline set?

Could you also describe the steps to reproduce this?

Also, could you paste the output of HGETALL asynq:{default}:t:315f4ee3-98e2-4f11-8f95-5e816aa48a38?

<!-- gh-comment-id:1024957714 --> @hibiken commented on GitHub (Jan 29, 2022): I see. thank you for providing the info! It seems like the task IDs are in the active set but not in the deadline set? Could you also describe the steps to reproduce this? Also, could you paste the output of `HGETALL asynq:{default}:t:315f4ee3-98e2-4f11-8f95-5e816aa48a38`?
Author
Owner

@hibiken commented on GitHub (Feb 1, 2022):

@nkbai Please let me know if you are still seeing the issue!

<!-- gh-comment-id:1026928811 --> @hibiken commented on GitHub (Feb 1, 2022): @nkbai Please let me know if you are still seeing the issue!
Author
Owner

@nkbai commented on GitHub (Feb 5, 2022):

Sorry, this is caused by my misoperation. I set the retry times of this task to 1.

<!-- gh-comment-id:1030568022 --> @nkbai commented on GitHub (Feb 5, 2022): Sorry, this is caused by my misoperation. I set the retry times of this task to 1.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/asynq#173
No description provided.