A first yield that is not a task leaks the generator
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 65/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript, rust
- 領域
- backend
調査の方向性
Start at lib/duroxide.js:61, where JS stores the generator before the first step, and trace driveStep's handling of the yielded value. Then read src/handlers.rs, the parse in call_create_blocking (301-312) and the dispose guard (801-812) that only fires once set_gen_id was called. Reproduce with an orchestration whose first yield is yield 42; done means the orchestration fails as it does now but disposeGenerator runs and the map entry is gone.
索引モデルが issue の本文から書いたものです。
説明
Summary
If the first value that an orchestration yields is not a valid task, the generator object stays in the generators map for the life of the process.
Where
- JS stores the generator before the first step: https://github.com/microsoft/duroxide-node/blob/9fb6b853f6fa0d84da81e761e4c0bf288217f70d/lib/duroxide.js#L61
- Rust parses the step result in
call_create_blocking. On a parse error it returns before it knows the generator ID: https://github.com/microsoft/duroxide-node/blob/9fb6b853f6fa0d84da81e761e4c0bf288217f70d/src/handlers.rs#L301-L312 - The guard disposes a generator only when its ID was set: https://github.com/microsoft/duroxide-node/blob/9fb6b853f6fa0d84da81e761e4c0bf288217f70d/src/handlers.rs#L801-L812
How it fails
- The orchestration yields something that is not a task as its first step. Examples are
yield 42and a Promise yielded by mistake. - JS returns
{ status: 'yielded', generatorId, task: 42 }. - Rust fails with
Invalid generator step result: ...and the orchestration fails. This part is right. guard.set_gen_idwas never called, sodisposeGeneratoris never called. The generator, its closure and its context stay in the map.
A bad value in a later step is handled: by then the guard knows the ID.
How this was checked
Read in the code. The Python SDK has the same code path, and a run there shows the leak: microsoft/duroxide-python#19.
Suggested fix
Either of these:
- In
driveStep, check that the yielded value is a task. If it is not, delete the generator and return an error. - In Rust, read
generatorIdfrom the raw JSON before the task is parsed, and dispose the generator on a parse error.
Tracked in microsoft/duroxide#55.
- 主要言語
- JavaScript
- スター
- 36
- フォーク
- 20
- 平均マージ
- 20時間 52分
- マージ済み PR(30日)
- 4
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/duroxide-node のほかの issue
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 58/100
microsoft/duroxide-node#18 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 28/100
microsoft/duroxide-node#16 ·
microsoft/duroxide-node の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
NationalSecurityAgency/skills-service#4052 ·
メンテナーはふだん 1 日以内に返信
-
documentation
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
githubnext/gh-aw-workshop#4251 ·
メンテナーはふだん 1 日以内に返信
-
customer-support needs-triage Platform(Default)
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
Leonxlnx/taste-skill#129 ·
メンテナーはふだん 1 日以内に返信