hibiken / asynq

Simple, reliable, and efficient distributed task queue in Go
MIT License
10.06k stars 720 forks source link

[BUG] Memory leaks caused by time.After #913

Closed biningo closed 2 weeks ago

biningo commented 2 months ago

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):

Additional context

pior commented 2 weeks ago

No longer an issue on Go 1.23

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