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

Issue with multiple consumers - re-delivering in progress jobs #110

Open
dmullings opened this issue Feb 7, 2023 · 2 comments
Open

Issue with multiple consumers - re-delivering in progress jobs #110

dmullings opened this issue Feb 7, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@dmullings
Copy link

Hello,

I'm not sure if I have found a bug or if this just a case of user error.

I am having an issue with running multiple workers on long running jobs (~20 minutes).

When add a message into the queue and then start 2 workers using the following command
bin/cake worker -c process-invoices -p process-invoices

Initially, 1 worker will begin to process the job. However, after about 5 minutes, the other worker also begins to start working on the same job.

I have set $maxAttempts = 1 in the job class.

Next, I tried to bind each processor to an unique name
bin/cake worker -c process-invoices -p process-invoices1
and
bin/cake worker -c process-invoices -p process-invoices2

The message is only picked up by 1 worker, however if another message gets added to the queue, the other worker receives the following error:

[LogicException] Processor was not found. processorName: "process-invoices2" in /var/www/html/vendor/enqueue/enqueue/ArrayProcessorRegistry.php on line 33

And when I don't bind the processor name and run the following command twice to create 2 workers
bin/cake worker -c process-invoices

I receive a similar error:

error: [LogicException] Processor was not found. processorName: "Cake\Queue\Queue\Processor63e2a1884f1c4" in /var/www/html/vendor/enqueue/enqueue/ArrayProcessorRegistry.php on line 33

For reference, the config for the queue is:

'Queue' => [
    'process-invoices' => [
        'url' => null,
        'queue' => 'process-invoices',
        'logger' => 'stdout',
        'receiveTimeout' => 10000,
        'storeFailedJobs' => true,
    ],
],

I am unable to figure out a method of having multiple workers without the errors or re-processing jobs.
Is there any config setting (visibility timeout) that I am missing to resolve my issues?

Thanks!

@amayer5125
Copy link
Contributor

What queue backend are you using? It sounds like a message reservation is running out and the queue is handing out the job a second time.

@dmullings
Copy link
Author

I am using Redis. Any idea of what would be causing the reservation to run out or what I need to change to fix the problem? Thanks!

@markstory markstory added the bug Something isn't working label Feb 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants