codingjoe / codingjoe/threadmill

Silently dropped task ids when the task hash is missing in acquire.lua and mover.lua

オープン
#50 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
12
フォーク
1
平均マージ
1日 1時間
マージ済み PR(30日)
10

説明

Split out of #48 during the fair multi-queue scheduling change (`codingjoe-fair-multi-queue-scheduling`).

`defer: Silent task loss when a ready/deferred set member's task hash is gone (acquire.lua drops the id, mover.lua drops a due id whose score is gone) with no result row written. Separate durability bug; the sets have no TTL. [threadmill/backends/lua/acquire.lua, threadmill/backends/lua/mover.lua]`

## Problem

`ZPOPMIN` removes the member before the data hash is read, so when `HGET` returns nothing (hash gone, or `cjson.decode` fails) the loop moves on and the task id is left nowhere: not in the ready set, not in the running set, and no result row is written.

`mover.lua` has the same shape: it drops a due id from the deferred set when `HGET score` returns nothing, again without a result row.

The ready and deferred sets have no TTL, while the task hash expires after `lease_ttl * 3 + result_ttl` (27 h with the defaults), so a backlog or a worker outage longer than that silently loses tasks instead of failing them. That conflicts with the project's Durability and Consistency design principles.

## Open questions

- Should the expired hash be reported as a FAILED result (with what payload, given the data is gone), or should the ready/deferred sets be bounded or refreshed instead?
- Is a synthetic result row even deserializable by `peek()` and the inspector, which expect a serialized `TaskResult`?

## QED

1. Enqueue a task.
2. Delete its hash key (`{prefix}:task:{id}`) while it stays in the ready set.
3. `acquire()` — the id vanishes with no trace.

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

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

調査の方向性

まず threadmill/backends/lua/acquire.lua と threadmill/backends/lua/mover.lua を読み、次に、ID がキューに残っている間に task hash を削除して QED ケースを再現します。結果行がどのようにシリアライズされ、peek() と inspector によって消費されるかを確認します。failure policy が決定され、task ids が暗黙に失われなくなり、選択した動作を regression coverage で検証できて初めて、issue は完了です。

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

評価

技術スタック
lua, redis
領域
backend, distributed-systems
issue の種類
バグ
難易度
5/5
見積もり時間
1週間以上
活発さ
活発
明瞭さ
説明が足りない
初心者へのやさしさ
35/100

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

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