[GH-ISSUE #764] [BUG] WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND #375

Open
opened 2026-03-02 05:20:46 +03:00 by kerem · 13 comments
Owner

Originally created by @jeffphp on GitHub (Oct 13, 2023).
Original GitHub issue: https://github.com/hibiken/asynq/issues/764

Originally assigned to: @hibiken on GitHub.

Describe the bug

I have 8 asynq workers on different machines (2 queues x 4 workers) and I regularly have this in the logs. My broker/backend is a unique Redis (7). I am using latest version of asynq (v0.24.1) :

asynq: pid=1 2023/10/13 07:29:56.418053 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:29:56.419020 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:30:56.423351 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:30:56.424304 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:30:56.425348 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:30:56.426263 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:31:56.430068 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:31:56.430850 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:31:56.431540 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:31:56.432297 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND

asynq: pid=1 2023/10/13 07:30:00.950383 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:30:00.951512 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:31:00.955868 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:31:00.956701 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:31:00.957690 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:31:00.958766 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:32:00.963465 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:32:00.964521 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:32:00.965856 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:32:00.967131 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND

asynq: pid=1 2023/10/13 07:29:05.304537 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:29:05.305448 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:30:05.309008 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:30:05.310101 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:30:05.311146 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:30:05.312563 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:31:05.316957 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:31:05.318012 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:31:05.319084 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:31:05.320076 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND

asynq: pid=1 2023/10/13 07:29:10.319618 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:29:10.321065 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:30:10.325028 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:30:10.326608 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:30:10.328063 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:30:10.329341 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:31:10.334770 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:31:10.336214 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:31:10.337392 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND
asynq: pid=1 2023/10/13 07:31:10.338755 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND

To Reproduce
Steps to reproduce the behavior :

  1. Setup x instances of asynq with a unique Redis.
  2. Enqueue a task with a unique ID and let it throw a SkipRetry error. It will be archived but will prevent a new task to be enqueued (Task ID Conflict)
  3. Enqueue a task with the same name. It will be active but orphaned
  4. See errors in logs.

Expected behavior

I would like the logs to be more explicit because I don't known which task is problematic.

Throwing a SkipRetry error on a unique Task seems to corrupt the queue. Ss the task is active but orphaned, it's impossible to delete the queue, except using ZRANGE/LRANGE manual redis queries.

Environment (please complete the following information):

  • Kubernetes / Docker
  • Redis 7 configured with allkeys-lru (but disk is only 25% full)
    v0.24.1

Update on october 21st

asynqmon shows the following error :
"Error
Could not retrieve queues live data — See the logs for details", but it doesn't mention what logs to watch for details.

Using asynq-cli, I get the following error on"asynq queue inspect low_priority" :
error: UNKNOWN: UNKNOWN: redis eval error: ERR user_script:30: attempt to perform arithmetic on local 'bytes' (a boolean value) script: 0c80fc1868e3aae205155ae2017ce995a3a7cec0, on @user_script:30.

Originally created by @jeffphp on GitHub (Oct 13, 2023). Original GitHub issue: https://github.com/hibiken/asynq/issues/764 Originally assigned to: @hibiken on GitHub. **Describe the bug** I have 8 asynq workers on different machines (2 queues x 4 workers) and I regularly have this in the logs. My broker/backend is a unique Redis (7). I am using latest version of asynq (v0.24.1) : asynq: pid=1 2023/10/13 07:29:56.418053 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:29:56.419020 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:30:56.423351 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:30:56.424304 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:30:56.425348 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:30:56.426263 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:31:56.430068 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:31:56.430850 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:31:56.431540 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:31:56.432297 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND ------------------------------------------------ asynq: pid=1 2023/10/13 07:30:00.950383 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:30:00.951512 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:31:00.955868 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:31:00.956701 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:31:00.957690 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:31:00.958766 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:32:00.963465 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:32:00.964521 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:32:00.965856 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:32:00.967131 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND ------------------------------------------------ asynq: pid=1 2023/10/13 07:29:05.304537 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:29:05.305448 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:30:05.309008 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:30:05.310101 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:30:05.311146 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:30:05.312563 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:31:05.316957 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:31:05.318012 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:31:05.319084 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:31:05.320076 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND ------------------------------------------------ asynq: pid=1 2023/10/13 07:29:10.319618 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:29:10.321065 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:30:10.325028 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:30:10.326608 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:30:10.328063 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:30:10.329341 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:31:10.334770 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:31:10.336214 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:31:10.337392 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND asynq: pid=1 2023/10/13 07:31:10.338755 WARN: recoverer: could not move task to archive: INTERNAL_ERROR: redis eval error: NOT FOUND **To Reproduce** Steps to reproduce the behavior : 1. Setup x instances of asynq with a unique Redis. 2. Enqueue a task with a unique ID and let it throw a SkipRetry error. It will be archived but will prevent a new task to be enqueued (Task ID Conflict) 3. Enqueue a task with the same name. It will be active but orphaned 4. See errors in logs. **Expected behavior** I would like the logs to be more explicit because I don't known which task is problematic. Throwing a SkipRetry error on a unique Task seems to corrupt the queue. Ss the task is active but orphaned, it's impossible to delete the queue, except using ZRANGE/LRANGE manual redis queries. **Environment (please complete the following information):** - Kubernetes / Docker - Redis 7 configured with allkeys-lru (but disk is only 25% full) v0.24.1 **Update on october 21st** asynqmon shows the following error : "Error Could not retrieve queues live data — See the logs for details", but it doesn't mention what logs to watch for details. Using asynq-cli, I get the following error on"asynq queue inspect low_priority" : error: UNKNOWN: UNKNOWN: redis eval error: ERR user_script:30: attempt to perform arithmetic on local 'bytes' (a boolean value) script: 0c80fc1868e3aae205155ae2017ce995a3a7cec0, on @user_script:30.
Author
Owner

@jeffphp commented on GitHub (Oct 22, 2023):

As a workaround I ended up stopping using asynq.SkipRetry error because it corrupts the queue when used with a Unique ID task.

<!-- gh-comment-id:1774173708 --> @jeffphp commented on GitHub (Oct 22, 2023): As a workaround I ended up stopping using asynq.SkipRetry error because it corrupts the queue when used with a Unique ID task.
Author
Owner

@kamikazechaser commented on GitHub (Oct 23, 2023):

Could you try if #709 fixes this issue?

<!-- gh-comment-id:1774381764 --> @kamikazechaser commented on GitHub (Oct 23, 2023): Could you try if #709 fixes this issue?
Author
Owner

@jeffphp commented on GitHub (Oct 23, 2023):

Could you try if #709 fixes this issue?

I will definitely do. For the time being, I am trying to reproduce it but it's more elaborate that I thought. I think that another condition is that the worker is being stopped in the meanwhile. I'll let you know.

<!-- gh-comment-id:1774594688 --> @jeffphp commented on GitHub (Oct 23, 2023): > Could you try if #709 fixes this issue? I will definitely do. For the time being, I am trying to reproduce it but it's more elaborate that I thought. I think that another condition is that the worker is being stopped in the meanwhile. I'll let you know.
Author
Owner

@bingtianyiyan commented on GitHub (Jan 31, 2024):

As a workaround I ended up stopping using asynq.SkipRetry error because it corrupts the queue when used with a Unique ID task.

i have not use Unique ID,it also have this error when consumer msg handler

<!-- gh-comment-id:1918307678 --> @bingtianyiyan commented on GitHub (Jan 31, 2024): > As a workaround I ended up stopping using asynq.SkipRetry error because it corrupts the queue when used with a Unique ID task. i have not use Unique ID,it also have this error when consumer msg handler
Author
Owner

@wuwenrufeng commented on GitHub (Feb 29, 2024):

The reason I encountered this situation is because I manually deleted some of the keys of asynq in redis, which caused data inconsistency. For example, ZRANGEBYSCORE asynq:{default}:lease -inf 1709175830 will find empty tasks. In short, it is okay not to manually delete data.

<!-- gh-comment-id:1970323283 --> @wuwenrufeng commented on GitHub (Feb 29, 2024): The reason I encountered this situation is because I manually deleted some of the keys of asynq in redis, which caused data inconsistency. For example, ZRANGEBYSCORE asynq:{default}:lease -inf 1709175830 will find empty tasks. In short, it is okay not to manually delete data.
Author
Owner

@jackbaron commented on GitHub (Mar 31, 2025):

@wuwenrufeng I have same problem how to solved. You found any solution?

<!-- gh-comment-id:2764941303 --> @jackbaron commented on GitHub (Mar 31, 2025): @wuwenrufeng I have same problem how to solved. You found any solution?
Author
Owner

@imamrafii commented on GitHub (Apr 4, 2025):

Do you guys have any solution to clearing orphaned tasks caused by manually deleting data?

<!-- gh-comment-id:2777445787 --> @imamrafii commented on GitHub (Apr 4, 2025): Do you guys have any solution to clearing orphaned tasks caused by manually deleting data?
Author
Owner

@jackbaron commented on GitHub (Apr 4, 2025):

@imamrafii This is solution working for me

``
DEL "asynq:{default}:t:task-id-generate"

ZREM asynq:{default}:task-id-generate
``

<!-- gh-comment-id:2777545369 --> @jackbaron commented on GitHub (Apr 4, 2025): @imamrafii This is solution working for me `` DEL "asynq:{default}:t:task-id-generate" ZREM asynq:{default}:task-id-generate ``
Author
Owner

@jeffphp commented on GitHub (Apr 4, 2025):

Do you guys have any solution to clearing orphaned tasks caused by manually deleting data?

Still not

<!-- gh-comment-id:2777650309 --> @jeffphp commented on GitHub (Apr 4, 2025): > Do you guys have any solution to clearing orphaned tasks caused by manually deleting data? Still not
Author
Owner

@jeffphp commented on GitHub (May 26, 2025):

In the end, it happens when one of the worker has a fatal error when processing a task (OOMKilled or Fatal Error). It ends up not sending an acknowledgement and the task is archived. If a lot of tasks get archived this way, it stops responding. If the tasks are manually retried, they become Orphaned.

The only way to get out of this is to make sure that workers don't die (!). If it happens, you can delete the whole queue using :

go install github.com/hibiken/asynq/tools/asynq@latest

And then delete the "ill" queue :
asynq queue rm --force <queue_name>

<!-- gh-comment-id:2909034265 --> @jeffphp commented on GitHub (May 26, 2025): In the end, it happens when one of the worker has a fatal error when processing a task (OOMKilled or Fatal Error). It ends up not sending an acknowledgement and the task is archived. If a lot of tasks get archived this way, it stops responding. If the tasks are manually retried, they become Orphaned. The only way to get out of this is to make sure that workers don't die (!). If it happens, you can delete the whole queue using : go install github.com/hibiken/asynq/tools/asynq@latest And then delete the "ill" queue : asynq queue rm --force <queue_name>
Author
Owner

@jeffphp commented on GitHub (Dec 4, 2025):

I think I found the origin of the problem (in my case): I use a managed Redis and found out that it was killing idle connections after 5 minutes. I had this kind of errors : write tcp 10.244..:36820->206.189..:25061: write: broken pipe

I ended up configuring my Redis client with this:
opt.PoolSize = 20
opt.ConnMaxIdleTime = 3 * time.Minute
Now everything seems to work.

<!-- gh-comment-id:3611269765 --> @jeffphp commented on GitHub (Dec 4, 2025): I think I found the origin of the problem (in my case): I use a managed Redis and found out that it was killing idle connections after 5 minutes. I had this kind of errors : write tcp 10.244.**.**:36820->206.189.**.**:25061: write: broken pipe I ended up configuring my Redis client with this: opt.PoolSize = 20 opt.ConnMaxIdleTime = 3 * time.Minute Now everything seems to work.
Author
Owner

@ncimbaljevic commented on GitHub (Dec 9, 2025):

configuring my Redis client with this: opt.ConnMaxIdleTime = 3 * time.Minute

@jeffphp
DUDE! You just made my agony to go away!
Such a easy and logical thing, however I haven't tried it until I read it here.

Cudos to you Sir!

<!-- gh-comment-id:3630208173 --> @ncimbaljevic commented on GitHub (Dec 9, 2025): > configuring my Redis client with this: opt.ConnMaxIdleTime = 3 * time.Minute @jeffphp DUDE! You just made my agony to go away! Such a easy and logical thing, however I haven't tried it until I read it here. Cudos to you Sir!
Author
Owner

@jeffphp commented on GitHub (Dec 9, 2025):

configuring my Redis client with this: opt.ConnMaxIdleTime = 3 * time.Minute

@jeffphp DUDE! You just made my agony to go away! Such a easy and logical thing, however I haven't tried it until I read it here.

Cudos to you Sir!

You're very welcome, I struggled for month with this too! I think that lots of errors (redis eval, redis broken pipe, etc) are related to this.

By the way, asynq.RedisClientOpt{} should definitely provide this ConnMaxIdleTime option with a default value lower than 5 minutes (which seems to be the standard value). I had to use the UniversalClient to make it work properly.

cc @hibiken

<!-- gh-comment-id:3630993579 --> @jeffphp commented on GitHub (Dec 9, 2025): > > configuring my Redis client with this: opt.ConnMaxIdleTime = 3 * time.Minute > > [@jeffphp](https://github.com/jeffphp) DUDE! You just made my agony to go away! Such a easy and logical thing, however I haven't tried it until I read it here. > > Cudos to you Sir! You're very welcome, I struggled for month with this too! I think that lots of errors (redis eval, redis broken pipe, etc) are related to this. By the way, asynq.RedisClientOpt{} should definitely provide this ConnMaxIdleTime option with a default value lower than 5 minutes (which seems to be the standard value). I had to use the UniversalClient to make it work properly. cc @hibiken
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#375
No description provided.