A first yield that is not a task leaks the generator
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ả
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.
- 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
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/duroxide-node
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 58/100
microsoft/duroxide-node#18 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 28/100
microsoft/duroxide-node#16 ·
Tất cả issue của microsoft/duroxide-node
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
hexlet-codebattle/codebattle#2361 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
micromatch/picomatch#223 ·
Maintainer thường phản hồi trong vòng 11 ngày
-
Upgrade MongoDB Node.js driver to 7.6+ for full MongoDB 9.0 compatibilityCó thể đã có người làm @ga262 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
parse-community/parse-server#10754 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
🐛 bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
margelo/react-native-vision-camera#4211 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
platformatic/platformatic#5161 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày