Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

A first yield that is not a task leaks the generator

Ouverte
#19 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
65/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
javascript, rust
Domaine
backend

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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.

Langage dominant
JavaScript
Étoiles
36
Forks
20
Merge moyen
20 h 52 min
PR mergées (30 j)
4

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de microsoft/duroxide-node

Toutes les issues de microsoft/duroxide-node

Issues similaires

Plus d'issues JavaScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.