A call in a context completes only when the guest event loop drains, and nothing runs between calls. One stray handle therefore fails an otherwise finished call and wipes the context's state.
Observed (each run in a context, then a second call to see what survived)
| Code |
Result |
setInterval(() => {}, 50) |
timed_out; state cleared |
Start an http server (with or without server.unref()) |
timed_out; server killed; state cleared |
setInterval(...).unref() |
Returns, but the timer never fires again, even during later calls |
| Un-awaited promise on a ref'd timer |
The call blocks until it settles; a concurrent call rejects with execution_busy |
Why it matters
Generated code leaves intervals and kept-alive sockets behind all the time. Losing the whole context for it is surprising, and it is the same family as the slow dispose after network use.
Proposal
Keep contexts idle-only and one call at a time, but complete a call when its top-level promise settles, and cancel leftover handles without failing the call or clearing state. Optionally add a bounded per-context queue instead of rejecting with execution_busy.
A call in a context completes only when the guest event loop drains, and nothing runs between calls. One stray handle therefore fails an otherwise finished call and wipes the context's state.
Observed (each run in a context, then a second call to see what survived)
setInterval(() => {}, 50)timed_out; state clearedhttpserver (with or withoutserver.unref())timed_out; server killed; state clearedsetInterval(...).unref()execution_busyWhy it matters
Generated code leaves intervals and kept-alive sockets behind all the time. Losing the whole context for it is surprising, and it is the same family as the slow dispose after network use.
Proposal
Keep contexts idle-only and one call at a time, but complete a call when its top-level promise settles, and cancel leftover handles without failing the call or clearing state. Optionally add a bounded per-context queue instead of rejecting with
execution_busy.