[GH-ISSUE #243] [BUG] Redis Error when enqueuing using Goroutine #2114

Closed
opened 2026-03-15 19:13:10 +03:00 by kerem · 1 comment
Owner

Originally created by @sujit-baniya on GitHub (Feb 13, 2021).
Original GitHub issue: https://github.com/hibiken/asynq/issues/243

Originally assigned to: @hibiken on GitHub.

When many tasks are enqueued within multiple goroutine, the error occurs stating: panic: redis: connection pool timeout

To Reproduce

        var wg sync.WaitGroup
	for i := 0; i <= 100000; i++ {
		wg.Add(1)
		go func() {
			defer wg.Done()
			// Create a task with typename and payload.
			t1 := asynq.NewTask(taskType, payload)
			// Process the task immediately.
			_, err := Client.Enqueue(t1, asynq.Queue(queue))
			if err != nil {
				panic(err)
			}
		}()
	}
	wg.Wait()
Originally created by @sujit-baniya on GitHub (Feb 13, 2021). Original GitHub issue: https://github.com/hibiken/asynq/issues/243 Originally assigned to: @hibiken on GitHub. When many tasks are enqueued within multiple goroutine, the error occurs stating: `panic: redis: connection pool timeout` **To Reproduce** ```go var wg sync.WaitGroup for i := 0; i <= 100000; i++ { wg.Add(1) go func() { defer wg.Done() // Create a task with typename and payload. t1 := asynq.NewTask(taskType, payload) // Process the task immediately. _, err := Client.Enqueue(t1, asynq.Queue(queue)) if err != nil { panic(err) } }() } wg.Wait() ```
kerem 2026-03-15 19:13:10 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@hibiken commented on GitHub (Apr 13, 2021):

Duplicate of #256.
You can tune dial/read/write timeout now via RedisConnOpt when instantiating Client and Server.

Feel free to re-open the issue if you are still having this issue 👍

<!-- gh-comment-id:818805156 --> @hibiken commented on GitHub (Apr 13, 2021): Duplicate of #256. You can tune dial/read/write timeout now via `RedisConnOpt` when instantiating `Client` and `Server`. Feel free to re-open the issue if you are still having this issue 👍
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#2114
No description provided.