-
Notifications
You must be signed in to change notification settings - Fork 424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ECONNREFUSED Error when adding Job to Queue #83
Comments
Is your app running in a Docker container? Right now I'm having an issue, but it only refuses connection when the API is running in its own container. I think it's similar to this ioredis issue that has a few potential solutions though. |
Yeah, my app is running in a kubernetes cluster |
I have mine also running in Kubernetes with my Redis setup with Redis Sentinel and 3 instance. It works great for a while. I use to get this exact error before setting up Sentinel, so I figured I would setup Sentinel to make it more redundant. Now, it's all working but there is some truly strange weirdness that I can't figure out.
What I don't know if this behavior is specific to IORedis or if its some odd way BullMQ is using it? I don't know tbh. |
@elucidsoft my gut feeling is that this is an ioredis issue, it would be great if you can verify it just with a simple redis example. I already posted an issue regarding connection in the ioredis repo: |
Is there a call I can use for my health checks other than queue.add that would cause this? Would love a method called isHealthy() would make doing health checks a freaking breeze with Bull. I think I'll put in a request for this. |
This a a non-issue, after months of testing, troubleshooting, and refining here is the deal. If redis is terminated forcefully, for instance if your on a preemptive node or a spot instance type of situation and your redis instance is given zero notice for graceful shutdown you can end up in this situation. But it has nothing to do with BullMq. It's an odd issue with connection state with Redis, when this happens it seems when Redis comes back up it performs some actions to restore it's state, etc. During that time, IORedis will be connecting to it, those connections that connect to it before Redis is ready end up only able to perform a very limited set of actions for whatever reason, and IORedis is not capable of recovering from this situation. The only way out is a full restart of the application, some internal state in IORedis is preventing a recovery of this state. In any case, I have not had this happen to me in several months now, so I am 100% stable. If the clients get killed it does not affect anything. You will see this error occasionally when that happens, but in all instances I've seen a 100% full recovery in a matter of seconds. Morale of the story, don't put StatefulSets on volatile node types. In fact, if you read Kubernetes documentation, they actually mention this being unsupported. |
I created an IORedis instance and initiated a queue,
then it fails with the error below when i try to add a Job to Queue
While debugging i thought it was my Redis connection then i added the code below before calling
Queue.add
and it returns the keys successfully, whileQueue.add
still failsI have tried downgrading to 1.4.3 too
Any help would be greatly appreciated!
The text was updated successfully, but these errors were encountered: