Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

A failed activity lock renewal can lose the activity result; the orchestration waits forever

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

メンテナーはふだん 1 日以内に返信

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
rust

調査の方向性

Read the renewal-error branch in src/runtime/dispatchers/worker.rs and the cancellation branch of run_activity_with_cancellation there. The issue says distinguishing a lost lock from retryable provider errors and avoiding deletion while the lock may still be valid are relevant; inspect provider error handling before assessing the scope. Done means a transient renewal failure does not lose the activity result, and the orchestration receives its completion or failure.

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

説明

bug

Summary

One failed call to renew_work_item_lock can lose an activity result for good. The orchestration that scheduled the activity then waits forever.

The activity manager treats every renewal error as "the lock was stolen". It does this also for an error that goes away, such as a dropped connection or a pool timeout, while the lock is still valid.

Where

How it fails

  1. An activity runs. Its lock is valid.
  2. One renew_work_item_lock call returns an error. The lock is still valid.
  3. The activity manager calls cancellation_token.cancel() and stops renewing.
  4. The dispatcher takes the cancellation branch. It waits up to activity_cancellation_grace_period for the activity to return.
  5. The dispatcher calls ack_work_item(token, None). None means "delete the work item and queue nothing".
  6. The lock is still valid, so the provider deletes the row. No ActivityCompleted and no ActivityFailed is queued.
  7. The orchestration never gets a result for this activity. It stays Running forever, unless its own code has a timeout.

The window is the time between the failed renewal and the lock expiry. With the defaults (30 s lock, renewal 5 s before the end) it is 5 s. An activity that checks for cancellation returns well inside that window. So the well-behaved activities are the ones that lose their result.

If the activity returns after the lock expired, the ack fails, the row stays, and another worker runs the activity again. That case is fine.

Reproduction

Reproduced on PostgreSQL with duroxide 0.1.30 and duroxide-pg 0.1.35, through the Node.js SDK.

  1. Runtime with worker_lock_timeout = 6 s. The lock is renewed every 3 s.
  2. Start an orchestration that awaits one activity. The activity loops and returns as soon as is_cancelled() is true.
  3. After 1 s, rename the SQL function renew_work_item_lock for 3.5 s, then rename it back. One renewal fails while the lock stays valid.
  4. Wait 9 s.

Result:

  • The orchestration status is still Running.
  • worker_queue has 0 rows and orchestrator_queue has 0 rows.
  • The history has ActivityScheduled and no completion event.

Suggested fix

  • In the activity manager, cancel only when the provider reports that the lock is gone. Retry other errors, at least until the lock would expire.
  • That needs a way to tell "lock not found" from other failures. Today both arrive as a ProviderError. An error kind for "lock lost" would do it.
  • In the cancellation branch, do not delete a work item whose lock can still be valid. Abandon it, so it is delivered again.

Related

Tracked in #55.

主要言語
Rust
スター
226
フォーク
62
平均マージ
20時間 46分
マージ済み PR(30日)
6

環境構築

はじめの一歩

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

microsoft/duroxide のほかの issue

microsoft/duroxide の issue をすべて見る

似ている issue

Rust の issue をもっと見る

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

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