Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

A first yield that is not a task leaks the generator

未关闭
#19 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
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 内容生成。

描述

bug

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

How it fails

  1. The orchestration yields something that is not a task as its first step. Examples are yield 42 and a Promise yielded by mistake.
  2. JS returns { status: 'yielded', generatorId, task: 42 }.
  3. Rust fails with Invalid generator step result: ... and the orchestration fails. This part is right.
  4. guard.set_gen_id was never called, so disposeGenerator is 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 generatorId from 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 分钟
30 天内合并 PR
4

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoft/duroxide-node 的其他 Issue

查看 microsoft/duroxide-node 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。