Jobs stuck in "waiting" in bull queue node.js
Asked Answered
A

3

14

I had a bunch of jobs in bull queue when one got stuck for 1+ hours (normally takes ~2 minutes to run), but didn't fail. I was unable to remove the job from the active state with the bull arena UI that I use, so I deleted the key of the active job in Redis.

That removed the stuck active job, but now the queue isn't pulling any jobs off of the waiting list.

Any ideas? Any thoughts on how to fix it?

Abiding answered 29/4, 2020 at 14:21 Comment(7)
i am facing a similar issue, jobs seems to be stuck in waiting state. did you manage to fix this?Monicamonie
I renamed the queue in my source code and then redeployed. Definitely not an ideal solution but it did get everything unstuck and flowing again.Abiding
thanks @Abiding for your reply. had another question did you implement the process method called as a separate process? github.com/OptimalBits/bull#separate-processes. wanted to know how to find if its performing better then the regular appraochMonicamonie
@Abiding I am seeing the same issue. Renaming the queue did fix the issue. Have you or anyone come to a root cause for this issue?Innsbruck
Also happened to me. Random jobs seem to stay in WAITING state and after a reaching max retries, it fails. Renaming the queue fixes it. I think something becomes stale in redis when you manually remove a key and leads to this behaviour. Renaming is the same as creating a new queue from scratch.Discontinuity
I have the same issue, but in an active state, btw I have 30 concurrent processes, sometimes in the next day total of a stuck is different, but when I retry manually the queue is running properly. is better to rename the queue?Sluggard
Worth mentioning, in case you have development and production version make sure to make a distinction in the naming of the queue. Otherwise any of the worker might pick up the task. If the codebase are on different version you will get odd results, debugger not stopping.Jun
R
1

i was having the same problem. and then i realized i didn't add connection option for worker. If connection is not added for worker, you can add it as same as queue.

new Worker(
  QUEUE_NAME,
  async job => {
    // ...
  },
  {
    connection: redisConnection,
  },
)
Rentschler answered 23/8, 2023 at 14:52 Comment(0)
M
0

I faced the same, but later I figured out that I had another worker running on another system which was also processing jobs from the same Queue. So yeah renaming the queue worked for me as well.

  • Make sure no other applications(same or different env) are connected to the same Redis server which has Workers/Processes that listen to the common Queues.
Maniemanifest answered 23/4, 2024 at 4:14 Comment(0)
D
-1

I faced similar issue a moment ago. However, I was able to overcome the challenge by changing the order of my program functions that did specific task such as defining the queue, adding to the queue and defining a process.

Initially I had a flow like this 👇

  1. Create queue
  2. Define the process
  3. Add to the queue

But after facing the issue I changed it to

  1. Create queue
  2. Add to the queue
  3. Define the process
Deportee answered 8/2, 2022 at 7:4 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.