Worker is trying to rescue jobs from queues that are not assigned to it
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 50/100
調査の方向性
Start with riverdriver/riverpgxv5/internal/dbsqlc/river_job.sql at the rescue query and internal/maintenance/job_rescuer.go around makeRetryDecision. Trace how queue assignments and registered job types are used during rescue, then review the Inserting and working jobs and Multiple queues documentation. Done means the intended behavior is confirmed and the queue-registration requirement or rescue behavior is made unambiguous.
索引モデルが issue の本文から書いたものです。
説明
A bit of context
We have two kinds of workers at the moment, sharing the same database, let's say worker-1 is running jobs from queue-1 and worker-2 is running jobs from queue-2. However, we are using the same binary for the worker and we recently tried registering jobs conditionally, basically registering only those jobs that are supposed to be executed by this worker based on queue selection.
Another thing to mention is that our RescueStuckJobsAfter is configured to be pretty small (30s) whereas timeouts on the jobs are minutes.
An issue
After introducing this conditional registration, we observed the following behaviour:
worker-1is fetching all jobs (for both queues) to rescue: https://github.com/riverqueue/river/blob/eb0b9854baa90b073783ae76841df154c311b7dd/riverdriver/riverpgxv5/internal/dbsqlc/river_job.sql#L257-L263- amongst others, it can fetch jobs dedicated for
queue-2and they are not registered in theworker-1, somakeRetryDecisiondiscards the job: https://github.com/riverqueue/river/blob/eb0b9854baa90b073783ae76841df154c311b7dd/internal/maintenance/job_rescuer.go#L302-L307
Checked documentation if we are missing something, and both pages that could have mention any details of this behaviour are not saying anything about our weird case:
- Inserting and working jobs does not mention if all jobs from a single database have to be registered in all workers
- Multiple queues only says but workers will only select jobs to work for queues that they're configured to handle, but still it is unclear if we should register all jobs or not
A very bad side effect of this for us was that discarded job continued execution (context wasn't cancelled) and another job with the same unique_key was scheduled, violating unique constraint that we are relying on for correctness, but I am not blaming this on river, this is a consequence of our ignorance of rescue mechanics nuances.
Short-term we fixed our issue by again registering all jobs in the worker binary regardless its configuration, but it would be valuable to have an answer if this is a designed behaviour or a bug?
- 主要言語
- Go
- スター
- 5.7k
- フォーク
- 179
- 平均マージ
- 2日 19時間
- マージ済み PR(30日)
- 12
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
riverqueue/river のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 45/100
riverqueue/river#1358 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
riverqueue/river#1258 · コメント 7 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
riverqueue/river#1225 · コメント 14 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
riverqueue/river#1185 · コメント 2 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
riverqueue/river#1183 · リアクション 2 件 ·
riverqueue/river の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
-
Bob Shell support オープンenhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
santhosh-tekuri/jsonschema#276 ·