A first yield that is not a task leaks the generator
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 65/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, rust
- Ambito
- backend
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- JavaScript
- Stelle
- 36
- Fork
- 20
- Merge medio
- 20h 52m
- PR unite (30g)
- 4
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoft/duroxide-node
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 58/100
microsoft/duroxide-node#18 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 28/100
microsoft/duroxide-node#16 ·
Tutte le issue di microsoft/duroxide-node
Issue simili
-
triage-needed
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
MicrosoftDocs/edge-developer#3970 ·
I maintainer di solito rispondono entro 1 giorno
-
agent/scanner hive/hosted-available-lke648397-260827-5n31 quality testing
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
PWA stores a grouped number entry 1000x too small in German localeForse già presa @Minhal128 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Add: YRF MusicApertacheck:passed feeds:add
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
iptv-org/database#37102 · 2 commenti ·
I maintainer di solito rispondono entro 9 giorni
-
[workshop-sim] Repair: Add a fallback sample .lock.yml to the Agentic Workflows Intro Activity 1Apertafeedback simulation workshop
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
githubnext/gh-aw-workshop#4328 ·
I maintainer di solito rispondono entro 1 giorno