[GH-ISSUE #449] [BUG] Scheduler flooding log messages #207

Closed
opened 2026-03-02 05:19:37 +03:00 by kerem · 1 comment
Owner

Originally created by @gustavosbarreto on GitHub (May 5, 2022).
Original GitHub issue: https://github.com/hibiken/asynq/issues/449

Originally assigned to: @hibiken on GitHub.

Describe the bug

Scheduler starts flooding log messages when enqueuing a duplicated task.

The following log entry are displayed multiple times:

asynq: pid=2169 2022/05/05 12:06:10.003385 ERROR: scheduler could not enqueue a task &{typename:telemetry:worker payload:[] opts:[] w:<nil>}: task ID conflicts with another task

EDIT: Also it is not possible to set a nil logger because it is overridden by the default chatty logger:

scheduler := asynq.NewScheduler(asynq.RedisClientOpt{Addr: addr.Host}, &asynq.SchedulerOpts{Logger: nil})

To Reproduce

  1. Setup a periodic task
  2. Scale your service up to 2+ instances
  3. See log messages

Expected behavior

From my point of view, in a distributed system (with multiple instances) a duplicated task error should not be considered an error or at least not automatically logged, leaving it up to whoever is using the library (providing a custom error handler).

Additional context

github.com/hibiken/asynq@9116c096ec/scheduler.go (L129)

Originally created by @gustavosbarreto on GitHub (May 5, 2022). Original GitHub issue: https://github.com/hibiken/asynq/issues/449 Originally assigned to: @hibiken on GitHub. **Describe the bug** Scheduler starts flooding log messages when enqueuing a duplicated task. The following log entry are displayed multiple times: ``` asynq: pid=2169 2022/05/05 12:06:10.003385 ERROR: scheduler could not enqueue a task &{typename:telemetry:worker payload:[] opts:[] w:<nil>}: task ID conflicts with another task ``` EDIT: Also it is not possible to set a nil logger because it is overridden by the default chatty logger: ``` scheduler := asynq.NewScheduler(asynq.RedisClientOpt{Addr: addr.Host}, &asynq.SchedulerOpts{Logger: nil}) ``` **To Reproduce** 1. Setup a periodic task 2. Scale your service up to 2+ instances 3. See log messages **Expected behavior** From my point of view, in a distributed system (with multiple instances) a duplicated task error should not be considered an error or at least not automatically logged, leaving it up to whoever is using the library (providing a custom error handler). **Additional context** https://github.com/hibiken/asynq/blob/9116c096ecf3e8493f9997d2b906fa847b0d1a2c/scheduler.go#L129
kerem 2026-03-02 05:19:37 +03:00
Author
Owner

@hibiken commented on GitHub (May 10, 2022):

@gustavosbarreto Thank you for the feedback!

I see, since we do provide EnqueueErrorHandler, we probably should probably lower the log-level (or potentially remove it entirely). I'll work on this one soon 👍

<!-- gh-comment-id:1122357212 --> @hibiken commented on GitHub (May 10, 2022): @gustavosbarreto Thank you for the feedback! I see, since we do provide `EnqueueErrorHandler`, we probably should probably lower the log-level (or potentially remove it entirely). I'll work on this one soon 👍
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#207
No description provided.