[GH-ISSUE #913] [BUG] Memory leaks caused by time.After #1469

Closed
opened 2026-03-07 22:09:48 +03:00 by kerem · 1 comment
Owner

Originally created by @biningo on GitHub (Sep 3, 2024).
Original GitHub issue: https://github.com/hibiken/asynq/issues/913

Originally assigned to: @hibiken on GitHub.

Describe the bug
timer.After() creates a new timer object each time it is called. Which can cause a memory leak in the for loop.
github.com/hibiken/asynq@d04888e748/subscriber.go (L61-L74)
github.com/hibiken/asynq@d04888e748/syncer.go (L60-L85)
To Reproduce

Expected behavior
Creating the timer object before the for loop.

Screenshots

Environment (please complete the following information):

  • OS: Linux
  • Version of asynq package v0.24.1

Additional context

Originally created by @biningo on GitHub (Sep 3, 2024). Original GitHub issue: https://github.com/hibiken/asynq/issues/913 Originally assigned to: @hibiken on GitHub. **Describe the bug** timer.After() creates a new timer object each time it is called. Which can cause a memory leak in the for loop. https://github.com/hibiken/asynq/blob/d04888e74845fc7434c6a50755e62ec6ffda5911/subscriber.go#L61-L74 https://github.com/hibiken/asynq/blob/d04888e74845fc7434c6a50755e62ec6ffda5911/syncer.go#L60-L85 **To Reproduce** **Expected behavior** Creating the timer object before the for loop. **Screenshots** **Environment (please complete the following information):** - OS: Linux - Version of `asynq` package v0.24.1 **Additional context**
kerem 2026-03-07 22:09:48 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@pior commented on GitHub (Nov 6, 2024):

No longer an issue on Go 1.23

https://github.com/hibiken/asynq/pull/914#issuecomment-2439589978

<!-- gh-comment-id:2459895851 --> @pior commented on GitHub (Nov 6, 2024): No longer an issue on Go 1.23 https://github.com/hibiken/asynq/pull/914#issuecomment-2439589978
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#1469
No description provided.