Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Engine: asynchronous code in the worker's publish causes events to be lost

Aperta
#1,394 0 commenti 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
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
node.js, typescript

Direzione di ricerca

Inizia dal ciclo asincrono delle dimensioni del payload introdotto in #1366 e traccia parentPort.postMessage fino all'arresto del worker. Riproduci i casi di ordinamento e di messaggi persi descritti qui, quindi verifica che gli eventi emessi escano dal worker nell'ordine e non vengano persi quando l'attività termina.

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

Descrizione

DevX

Inside the engine, we run job code in a worker thread. The worker thread sends events out to the main engine process through parentPort.postMessage

In production right now this is synchronous. When the message is posted the payload is processed and sent out of the child worker. This ensures that messages leave the worker_thread in the same order that they were emitted from the runtime.

In #1366 we use an async loop to read the size of a payload before sending it. This async loop is causing two problems:

  1. It no longer guarantees that events will leave the worker thread in the same order as they're emitted, because of the async yield. If message a takes longer to process than message b, than message b might be piped through the port first.
  2. Some messages don't get emitted at all because the worker thread is shut down while the events are being processed. When we complete the task and exit the run, I don't think there's anyway to know that messages are still processing and waiting to be emitted.

I don't think this is affecting production, but it's a possible cause of #1072. What I'm worried about is that a message emitted with a large-ish payload, but the worker thread gets killed before that message is completed.

I'd sort of expect node.js to handle that for me and not exit the worker until the message has finished posting, but it's possible that we're exiting too soon (because of code or config in the engine).

Lingua principale
TypeScript
Stelle
22
Fork
22
Merge medio
1g 7h
PR unite (30g)
24

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

  • Include un Dockerfile o un file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

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 OpenFn/kit

Tutte le issue di OpenFn/kit

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.