Worker is trying to rescue jobs from queues that are not assigned to it
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 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 小时
- 30 天内合并 PR
- 12
环境准备
我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
riverqueue/river 的其他 Issue
-
难度 5/5 一周以上 新手友好度 45/100
riverqueue/river#1358 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 35/100
riverqueue/river#1258 · 7 条评论 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 45/100
riverqueue/river#1225 · 14 条评论 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 52/100
riverqueue/river#1185 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 52/100
riverqueue/river#1183 · 2 个 reaction ·
维护者通常 1 天内回复
相似的 Issue
-
security
难度 2/5 1-3 小时 新手友好度 68/100
-
cvss-severity:high devguard l3montree-cybersecurity/...ard-k8s-image-inventory pkg:oci/devguard-k8s-ima...ch=amd64&tag=main-amd64 pkg:oci/devguard-k8s-ima...ch=arm64&tag=main-arm64 risk:low state:open
难度 1/5 1 小时以内 新手友好度 76/100
l3montree-dev/devguard#3094 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 84/100
JuliusBrussee/caveman#1127 · 1 条评论 ·
维护者通常 1 天内回复
-
enhancement low priority
难度 2/5 1-3 小时 新手友好度 85/100
eugenioenko/ttt#674 ·
维护者通常 1 天内回复
-
kind/bug
难度 2/5 1-3 小时 新手友好度 86/100
gpustack/gpustack-operator#640 ·
维护者通常 1 天内回复