ReviewOS

home-lang/home

Worker inbox ownership: release undelivered transfers when a worker stops

#469
Closed chris opened this 9 days ago ·
9 days ago

Split from #465; parent tracking #66 and #461. A bounded regression holds the terminated JavaScript Worker alive, queues a transferred MessagePort while its worker is blocked in a finite timer callback, then terminates before message delivery. Current Home leaves the surviving peer open (close count 0); Node closes it once. This is separate from GC or native CppTask capture collection: Worker::m_toWorker itself owns the undelivered transfer until Worker destruction.

The implementation checkpoint takes ownership of Worker.cpp via unified webcore-5, preserving all external companion implementations and the byte-identical Worker.h ABI. On stop, seal the incoming inbox under its admission lock, extract queued messages, and destroy them outside Worker/context-map locks. Late posts during Closing must serialize normally but not retain undeliverable transfers. Do not discard accepted parent-bound messages or run cancelled user handlers. Preserve the existing linked pre-enqueue reference-release hook and prevent startup from reopening a closing worker.

Verify retained-wrapper and release/GC variants, late posts, local queued transfers, nested-worker termination, exactly-once close/exit, normal delivery controls, and Node-API/FFI teardown. Generic task cancellation and callback-only poll cleanup remain #465; native work-pool quiescence is #468. Native build/verification in progress; not yet a completion or publication claim.

9 days ago

Implemented locally in 6de9852, authored and committed by Chris without coauthors. Seven inbox cases pass on Home and Node, including retained-Worker closure without GC. All 17 native regression files pass; focused corpus results are 15 pass, 3 upstream skips, 529 assertions. Native build and cached rebuild pass 14/14. Push failed on github.com DNS, so this issue remains open pending publication/review. Parent update: #66. General cancellation (#465), native jobs (#468), nested lifecycle (#470), and snapshot settlement (#471) are not claimed fixed.

9 days ago

Publication gate is now satisfied. 6de9852ea is reachable on current main and contains the Worker inbox sealing/disposal checkpoint verified above, including retained-wrapper, late-post, transfer, and normal-delivery controls. Generic queued-task cancellation remains #465 and nested-worker lifecycle remains #470. Closing this bounded inbox-ownership issue as completed.

Sign in to comment on this issue.