Recover module evaluations an abort cut short on a reused engine

Aperta
#2,254 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
22/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Ambito
backend

Direzione di ricerca

Start with EvaluateModule in source/engine/Goccia.Modules.pas, where the abort is recorded as the module's evaluation error, and read FindModule, which keeps returning that record. The issue asks that records whose linking or evaluation an abort left unfinished be reloaded on the next request, including async cycle members and deferred imports. Done means tests for a timed-out and a cancelled entry, a deferred import, an async cycle and repeated aborts on one engine all pass.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

Let a reused engine recover the module evaluations that an abort cut short, whatever stopped the run (a timeout, an instruction or memory limit, or a host cancellation), so a later run that imports the same module evaluates it again instead of replaying the abort.

Why

An embedder that reuses an engine after a limit or a cancellation expects the next run to behave like a fresh one for modules the aborted run never finished. Today the aborted evaluation is cached: a later import of the same module, or a later run of the same entry path, fails with the earlier run's abort error, or waits on an evaluation whose jobs were discarded.

Current behavior

EvaluateModule in source/engine/Goccia.Modules.pas records the abort as the module's evaluation error, and FindModule keeps returning that record. A module record that an earlier run created and linked, such as one imported with import defer, is evaluated first in the aborted run and keeps the error. Members of an async cycle whose root was interrupted keep waiting on it. A superseded record also stays rooted until the engine ends, so repeated aborts of a module that allocates retain one copy of its exports each.

Expected behavior

  • After any abort, the module records whose linking or evaluation the run started and did not finish load again on the next request, whatever run created them; finished modules, and records superseded for other reasons (ADR 0139), stay as they are.
  • Members of a cycle whose root the abort interrupted are recovered with it.
  • The same recovery applies when the abort is observed during the run and when a host cancellation is only reported after it.
  • Abandoned records release what nothing else references.
  • Tests cover a timed-out and a cancelled entry, a deferred import, an async cycle, and repeated aborts on one engine.

Scope notes

The abort handle work in #2239 recovers the narrower case of records the aborted run created; this issue covers the rest. Related: ADR 0139, #2051.

[!NOTE]
Created on behalf of @frostney using Claude Opus 5.5.

Lingua principale
Pascal
Stelle
21
Fork
6
Merge medio
13h 48m
PR unite (30g)
286

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di frostney/GocciaScript

Tutte le issue di frostney/GocciaScript

Issue simili

Altre issue su Backend & API Design

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.