[GH-ISSUE #1051] [BUG] Tasks stuck in active state #502

Open
opened 2026-03-02 05:37:54 +03:00 by kerem · 4 comments
Owner

Originally created by @asadzeynal on GitHub (May 22, 2025).
Original GitHub issue: https://github.com/hibiken/asynq/issues/1051

Originally assigned to: @hibiken, @kamikazechaser on GitHub.

Describe the bug
Tasks are accumulating over time in the active queue and never get processed. It seems like they accumulate in batches. Last time an increase of stale tasks happened (>1000), it happened during Redis failure under high load. We had a problem, which resulted in 40k tasks failing in a matter of seconds, redis started to return TOO_MANY_REQUESTS and other errors.

After that, the number of active tasks in queue increased forever (It is not the first time this happens).
The stuck tasks are completed in reality, just not deleted from the active queue. Also, they do not have corresponding entries in lease.

Environment (please complete the following information):

  • OS: Linux
  • asynq v0.25.1
  • Redis

To Reproduce
Not sure how to reproduce this behavior. Maybe stress redis until it starts returning TOO_MANY_REQUESTS might help, because this are the conditions under which it happened for us.

Screenshots
Image
Image
Image

Originally created by @asadzeynal on GitHub (May 22, 2025). Original GitHub issue: https://github.com/hibiken/asynq/issues/1051 Originally assigned to: @hibiken, @kamikazechaser on GitHub. **Describe the bug** Tasks are accumulating over time in the active queue and never get processed. It seems like they accumulate in batches. Last time an increase of stale tasks happened (>1000), it happened during Redis failure under high load. We had a problem, which resulted in 40k tasks failing in a matter of seconds, redis started to return TOO_MANY_REQUESTS and other errors. After that, the number of active tasks in queue increased forever (It is not the first time this happens). The stuck tasks are completed in reality, just not deleted from the active queue. Also, they do not have corresponding entries in **lease**. **Environment (please complete the following information):** - OS: Linux - asynq v0.25.1 - Redis **To Reproduce** Not sure how to reproduce this behavior. Maybe stress redis until it starts returning TOO_MANY_REQUESTS might help, because this are the conditions under which it happened for us. **Screenshots** ![Image](https://github.com/user-attachments/assets/0bdca113-99b1-4af5-9aac-ee5b320bc40f) ![Image](https://github.com/user-attachments/assets/b51cc62a-db93-4ff8-af03-52e0b11108f4) <img width="1300" alt="Image" src="https://github.com/user-attachments/assets/f9eee7eb-3cf7-40d7-b93a-9e2a39fc18b8" />
Author
Owner

@kamikazechaser commented on GitHub (May 22, 2025):

TOO_MANY_REQUESTS

Could you mention where and how redis is hosted?

<!-- gh-comment-id:2901251694 --> @kamikazechaser commented on GitHub (May 22, 2025): > TOO_MANY_REQUESTS Could you mention where and how redis is hosted?
Author
Owner

@Mdhesari commented on GitHub (Aug 18, 2025):

@asadzeynal please check this out and help me complete:
https://github.com/Mdhesari/asynq-issue-reproduction

here's the similar repduction of your issue, please take a look, I have used ai for faster reproduction after different kinds of prompts...

<!-- gh-comment-id:3197638808 --> @Mdhesari commented on GitHub (Aug 18, 2025): @asadzeynal please check this out and help me complete: https://github.com/Mdhesari/asynq-issue-reproduction here's the similar repduction of your issue, please take a look, I have used ai for faster reproduction after different kinds of prompts...
Author
Owner

@Ning-Qing commented on GitHub (Dec 26, 2025):

I've also encountered the same problem. May I ask if there are any solutions

<!-- gh-comment-id:3692396495 --> @Ning-Qing commented on GitHub (Dec 26, 2025): I've also encountered the same problem. May I ask if there are any solutions
Author
Owner

@Ning-Qing commented on GitHub (Dec 26, 2025):

@kamikazechaser help

<!-- gh-comment-id:3692430899 --> @Ning-Qing commented on GitHub (Dec 26, 2025): @kamikazechaser help
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#502
No description provided.