Skip to content

feat(container-runner): keep instance warm instead of self-exiting - #5531

Open
abcxff wants to merge 1 commit into
stack/chore-container-runner-default-stop-grace-to-10s-xnpvnuupfrom
stack/feat-container-runner-keep-instance-warm-instead-of-self-exiting-qqzrqpro
Open

feat(container-runner): keep instance warm instead of self-exiting#5531
abcxff wants to merge 1 commit into
stack/chore-container-runner-default-stop-grace-to-10s-xnpvnuupfrom
stack/feat-container-runner-keep-instance-warm-instead-of-self-exiting-qqzrqpro

Conversation

@abcxff

@abcxff abcxff commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@claude

claude Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review

Reviewed the container-runner "stay warm" change (container-runner/src/actor.rs, container-runner/src/main.rs, README, docs). The core logic reads cleanly and the removal of request_exit() calls from stop_child/on_start is consistent with the new "engine reaps via /start drain" model, which is a real, existing engine mechanism (request_lifespan / drain_grace_period in pegboard/src/workflows/serverless/conn.rs), so the premise checks out.

A few things worth a look:

  1. Stale doc comment on EXIT (container-runner/src/main.rs:67-69):

    /// Cancelled to bring the whole process down (actor stopped, failed start, or
    /// signal). main owns the exit sequencing.
    static EXIT: LazyLock<CancellationToken> = LazyLock::new(CancellationToken::new);

    This was not updated and now directly contradicts the new comment on request_exit a few lines below ("Only the platform shutdown signal drives this now: actors stopping or failing to start no longer exit the instance"). Worth fixing so the two comments do not disagree.

  2. Test coverage gap for the core new behavior: container-runner/examples/e2e-test/host/run-host-tests.sh scenario 6 (graceful destroy) still just destroys the actor and shuts the runner down immediately afterward, with no assertion that the runner process actually survives past the last actor on_destroy (no self-exit) and can accept a second placement on the same warm instance. Since "stay warm and reuse the instance" is the entire point of this PR, it would be good to add a scenario that destroys an actor, confirms the runner is still alive/serving /health, then creates a second actor against the same runner process to confirm reuse actually works end to end.

  3. Design question, not a blocker: previously, on_start failed-child-spawn path called request_exit when the instance was otherwise idle, explicitly to avoid handing a "poisoned" instance (broken environment, missing binary, etc.) the next placement. That guard is now gone; a failed start always leaves the instance warm and eligible for reuse. If the failure is systemic rather than actor-specific, the same instance could keep receiving new placements and failing them repeatedly for as long as request_lifespan allows. Worth confirming the engine has its own runner-health/backoff signal so it does not keep routing to an instance that just failed a start, since the runner no longer self-removes from rotation in that case.

  4. Minor nit: with request_exit only remaining caller (spawn_signal_handler) always setting SIGNAL_SHUTDOWN before cancelling EXIT, the else branch in async_main shutdown handling (main.rs:373-376) is now truly unreachable. The comment explaining it is kept as a deliberate fallback for a future actor-driven exit path is reasonable, but flagging in case the team prefers to delete it until it is actually needed again, per the repo general preference against speculative/dead code paths.

No security concerns (no new input handling), and the docs/README/mdx updates accurately describe the new behavior.

@abcxff
abcxff force-pushed the stack/feat-container-runner-keep-instance-warm-instead-of-self-exiting-qqzrqpro branch from d84e30f to b3a2e19 Compare July 31, 2026 05:27
@abcxff
abcxff force-pushed the stack/chore-container-runner-default-stop-grace-to-10s-xnpvnuup branch from c142ce3 to 4a79659 Compare July 31, 2026 05:27
@abcxff
abcxff force-pushed the stack/chore-container-runner-default-stop-grace-to-10s-xnpvnuup branch from 4a79659 to 395bd37 Compare July 31, 2026 06:03
@abcxff
abcxff force-pushed the stack/feat-container-runner-keep-instance-warm-instead-of-self-exiting-qqzrqpro branch from b3a2e19 to 3e9dbf4 Compare July 31, 2026 06:03
@abcxff
abcxff force-pushed the stack/feat-container-runner-keep-instance-warm-instead-of-self-exiting-qqzrqpro branch from 3e9dbf4 to ad0f63f Compare August 3, 2026 20:17
@abcxff
abcxff force-pushed the stack/chore-container-runner-default-stop-grace-to-10s-xnpvnuup branch from 395bd37 to 949ddff Compare August 3, 2026 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant