Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

A first yield that is not a task leaks the generator

Đang mở
#19 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
65/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
javascript, rust
Lĩnh vực
backend

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
JavaScript
Star
36
Fork
20
Merge trung bình
20 giờ 52 phút
Pull request đã merge (30 ngày)
4

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/duroxide-node

Tất cả issue của microsoft/duroxide-node

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.