A first yield that is not a task leaks the generator
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 65/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- javascript, rust
- Domínio
- backend
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- JavaScript
- Estrelas
- 36
- Forks
- 20
- Merge médio
- 20h 52min
- PRs com merge (30d)
- 4
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de microsoft/duroxide-node
-
bug
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 58/100
microsoft/duroxide-node#18 ·
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 28/100
microsoft/duroxide-node#16 ·
Todas as issues de microsoft/duroxide-node
Issues semelhantes
-
triage-needed
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
MicrosoftDocs/edge-developer#3970 ·
Mantenedores costumam responder em até 1 dia
-
agent/scanner hive/hosted-available-lke648397-260827-5n31 quality testing
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
Mantenedores costumam responder em até 1 dia
-
PWA stores a grouped number entry 1000x too small in German localeTalvez já em andamento @Minhal128 assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
Mantenedores costumam responder em até 1 dia
-
Add: YRF MusicAbertacheck:passed feeds:add
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
iptv-org/database#37102 · 2 comentários ·
Mantenedores costumam responder em até 9 dias
-
[workshop-sim] Repair: Add a fallback sample .lock.yml to the Agentic Workflows Intro Activity 1Abertafeedback simulation workshop
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
githubnext/gh-aw-workshop#4328 ·
Mantenedores costumam responder em até 1 dia