Skip to content
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

Redis Cluster, Can't add the job to the failed queue #2005

Open
wdh-1025 opened this issue Mar 26, 2021 · 17 comments
Open

Redis Cluster, Can't add the job to the failed queue #2005

wdh-1025 opened this issue Mar 26, 2021 · 17 comments
Labels

Comments

@wdh-1025
Copy link

In the environment of Redis cluster,Can't add the job to the failed queue,Job will hold the lock for a long time until the Job times out!

Description

queue.process('testjob', async (job,done) => {
     done(new Error('error transcoding'))
     //OR
     throw new Error('error transcoding')   
     //Can't add the job to the failed queue
})

Bull version

3.22.0

@manast
Copy link
Member

manast commented Mar 26, 2021

You must not use "done" and async at the same time in your process functions. Furthermore if you still have issues provide a complete reproducible case so we can look into it.

@wdh-1025
Copy link
Author

Thanks for the reply, but this still doesn't seem to solve my confusion!

const bull = require('bull');

const queue = new bull('cluster', {
    prefix: '{test}',
    redis: {
        port: 6401,
        host: '127.0.0.1',
        password: 'He2jY9K3LNplLmbFS50i',
    },
    defaultJobOptions: {
        attempts: 3,     
        removeOnComplete: true,
        backoff: false
    },
    limiter: {   
        max: 1000,
        duration: 5000,
        bounceBack: true
    },
    settings: {
        maxStalledCount: 1,
        guardInterval: 3000,
        retryProcessDelay: 500
    }
})

queue.add('test', { event: 'access_token', target: 'public' } )

queue.process('test', (job,done) => {
    //Can't add the job to the failed queue
    done(new Error('test error'))
})

@manast
Copy link
Member

manast commented Mar 26, 2021

A couple of things, did this same example work in non cluster redis? and secondly, how do you know the job did not end in the failed status?

@wdh-1025
Copy link
Author

It can work normally on non-cluster!
The job holds the lock for a long time after the error is thrown, and it is not added to the failed queue until a long time later (job stalled more than allowable limit)

@manast
Copy link
Member

manast commented Mar 26, 2021

ok, then you need to define the prefix for the queue like this: "{myPrefix}", default is "bull" which is nt compatible with cluster: https://github.com/OptimalBits/bull/blob/develop/PATTERNS.md#redis-cluster

@wdh-1025
Copy link
Author

As in the above case, I have defined the prefix, but still cannot achieve the expected effect,So I don't know if this is a framework compatibility issue. Is it possible to fix it in the future?

@manast
Copy link
Member

manast commented Mar 26, 2021

As in the above case, I have defined the prefix, but still cannot achieve the expected effect,So I don't know if this is a framework compatibility issue. Is it possible to fix it in the future?

oh yes sorry, I am blind this morning. What is your redis cluster setup?

@wdh-1025
Copy link
Author

I am not quite sure what you mean, Because my Redis is a purchased cloud service.
Redis Configuration(Redis 5.0 standard edition, dual copy, 2G cluster edition (2 shards))!

@manast
Copy link
Member

manast commented Mar 26, 2021

I need some setup in order to test it myself... is this in RedisLabs or where?

@wdh-1025
Copy link
Author

The Redis service I purchased from ALiYun

@manast
Copy link
Member

manast commented Mar 26, 2021

Ok, I will try to reproduce this in a local setup. However, if you do not need the cluster setup for other things than Bull then you could also switch to non cluster mode, since there are no advantages in using cluster with Bull.

@wdh-1025
Copy link
Author

Yes, but due to special reasons, I cannot switch to a non-clustered state. I look forward to making progress as soon as possible. Thanks again!

@stale
Copy link

stale bot commented Jul 12, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jul 12, 2021
@manast manast added bug and removed wontfix labels Jul 15, 2021
@davidnazw
Copy link

We're experiencing the same issue, I was wondering if this is planned to be fixed.

@manast
Copy link
Member

manast commented Jan 25, 2022

@davidnazw first I need to be able to easily reproduce it, I haven't so far...

@zangguojun
Copy link

Yes, but due to special reasons, I cannot switch to a non-clustered state. I look forward to making progress as soon as possible. Thanks again!

老哥 我也遇到同样的问题了 请问 你解决了吗?

@manast
Copy link
Member

manast commented Dec 4, 2023

As a side note, you may consider upgrading to BullMQ -> https://bullmq.io as there are no know issues with Redis Cluster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants