cakephp / cakephp/queue

Issue with multiple consumers - re-delivering in progress jobs

オープン
#110 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug
主要言語
PHP
スター
36
フォーク
22
平均マージ
20時間 36分
マージ済み PR(30日)
2

説明

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!

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、process-invoices 構成と長時間実行されるジョブを使用して、2 つの bin/cake worker プロセスで問題を再現します。worker のエントリポイントと報告された ArrayProcessorRegistry.php の失敗を読み、その後、一意のプロセッサ名と共有されたプロセッサ名での動作を比較します。複数の worker が、再配信や Processor was not found エラーなしでキューに入ったジョブを処理できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
php
領域
backend, distributed-systems
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。