[GH-ISSUE #555] [BUG] UNKNOWN: redis command error: SADD failed: redis: client is closed #2290

Open
opened 2026-03-15 19:58:18 +03:00 by kerem · 6 comments
Owner

Originally created by @linchao0815 on GitHub (Oct 11, 2022).
Original GitHub issue: https://github.com/hibiken/asynq/issues/555

Originally assigned to: @hibiken on GitHub.

Describe the bug
client.Enqueue(task)

To Reproduce
Steps to reproduce the behavior (Code snippets if applicable):

  1. Setup background processing ...
  2. Enqueue tasks ...
  3. See Error ...
  4. There is a low chance of this problem occurring.

How do I handle this error ?

Originally created by @linchao0815 on GitHub (Oct 11, 2022). Original GitHub issue: https://github.com/hibiken/asynq/issues/555 Originally assigned to: @hibiken on GitHub. **Describe the bug** client.Enqueue(task) **To Reproduce** Steps to reproduce the behavior (Code snippets if applicable): 1. Setup background processing ... 2. Enqueue tasks ... 3. See Error ... 4. There is a low chance of this problem occurring. How do I handle this error ?
Author
Owner

@domgolonka commented on GitHub (Oct 12, 2022):

I am getting the same thing

<!-- gh-comment-id:1276559004 --> @domgolonka commented on GitHub (Oct 12, 2022): I am getting the same thing
Author
Owner

@domgolonka commented on GitHub (Oct 12, 2022):

@linchao0815 I figured it out, the asynq.Client was closing too early.

<!-- gh-comment-id:1276786690 --> @domgolonka commented on GitHub (Oct 12, 2022): @linchao0815 I figured it out, the asynq.Client was closing too early.
Author
Owner

@linchao0815 commented on GitHub (Oct 13, 2022):

@domgolonka

@linchao0815 I figured it out, the asynq.Client was closing too early.
My case isn't it!

<!-- gh-comment-id:1276897423 --> @linchao0815 commented on GitHub (Oct 13, 2022): @domgolonka > @linchao0815 I figured it out, the asynq.Client was closing too early. My case isn't it!
Author
Owner

@MetaverseMan commented on GitHub (Apr 20, 2023):

@linchao0815 I figured it out, the asynq.Client was closing too early.

Figure it out,Same situation, thanks

<!-- gh-comment-id:1516692689 --> @MetaverseMan commented on GitHub (Apr 20, 2023): > @linchao0815 I figured it out, the asynq.Client was closing too early. Figure it out,Same situation, thanks
Author
Owner

@avvari-da commented on GitHub (Apr 5, 2024):

How do you fix asynq.Client was closing too early ?

<!-- gh-comment-id:2040599331 --> @avvari-da commented on GitHub (Apr 5, 2024): How do you fix `asynq.Client was closing too early` ?
Author
Owner

@refuse2speak commented on GitHub (Jul 7, 2024):

How do you fix asynq.Client was closing too early ?

When you create the client you probably have added a defer function as shown in the example. This is called too early, eg. when the enclosing function returns. You could add the defer function to the main() function so the Task Client is not closed before your main function returns.

image
<!-- gh-comment-id:2212593479 --> @refuse2speak commented on GitHub (Jul 7, 2024): > How do you fix `asynq.Client was closing too early` ? When you create the client you probably have added a defer function as shown in the example. This is called too early, eg. when the enclosing function returns. You could add the defer function to the main() function so the Task Client is not closed before your main function returns. <img width="741" alt="image" src="https://github.com/hibiken/asynq/assets/96352231/e7eda631-ac80-4387-a2d1-e480aeea6e49">
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#2290
No description provided.