Skip to content

A leftover handle turns a finished context call into timed_out and clears the context #1991

Description

@NathanFlurry

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions