Skip to content

RunnerManager.reload() terminates the previous runner immediately, resetting in-flight requests #91

Closed

Description

@pi0x

RunnerManager.reload(next) detaches the current runner, attaches next, and then awaits previous.close(). BaseEnvRunner.close() rejects pending requests and calls _closeRuntime(), which for node-worker is worker.terminate(). Everything the previous runner already accepted is cut off at the moment of the swap: in-flight fetches, streaming responses, and upgraded WebSockets.

Nitro's dev server reloads through manager.reload(runner), so every rebuild resets these connections. Short requests rarely notice. Long-lived ones do: SSE and streamed responses that run for minutes (agent turns, in eve's case) end with ECONNRESET mid-stream.

A drain mode would cover this: send new requests and upgrades to the new runner right away, keep the previous runner alive until its active exchanges and sockets settle (with an optional upper bound), then retire it through shutdown() instead of close(). For example reload(runner, { drain: true }) or { drain: { timeout } }, which Nitro's dev server could then opt into.

eve currently runs its own dev server for this reason. It counts active exchanges per runner and terminates a retired worker only once the last one settles (DrainedNitroDevServer). It would switch back to Nitro's createDevServer once equivalent drain semantics exist upstream.

Observed in [email protected].

Opened with AI assistance.

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