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.

@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
@abcxff
abcxff force-pushed the stack/chore-container-runner-default-stop-grace-to-10s-xnpvnuup branch from 949ddff to ea1de83 Compare August 10, 2026 17:16
@abcxff
abcxff force-pushed the stack/feat-container-runner-keep-instance-warm-instead-of-self-exiting-qqzrqpro branch from ad0f63f to 2fd10c6 Compare August 10, 2026 17:16
@abcxff
abcxff force-pushed the stack/feat-container-runner-keep-instance-warm-instead-of-self-exiting-qqzrqpro branch from 2fd10c6 to cc14c96 Compare August 10, 2026 19:03
@abcxff
abcxff force-pushed the stack/chore-container-runner-default-stop-grace-to-10s-xnpvnuup branch from ea1de83 to 688589a Compare August 10, 2026 19:03
@abcxff
abcxff force-pushed the stack/feat-container-runner-keep-instance-warm-instead-of-self-exiting-qqzrqpro branch from cc14c96 to d902009 Compare August 10, 2026 20:35
@abcxff
abcxff force-pushed the stack/chore-container-runner-default-stop-grace-to-10s-xnpvnuup branch from 2dc2e02 to 85d3a2f Compare August 10, 2026 22:09
@abcxff
abcxff force-pushed the stack/feat-container-runner-keep-instance-warm-instead-of-self-exiting-qqzrqpro branch from d902009 to 7562a64 Compare August 10, 2026 22:09
@claude

claude Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

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

Small, focused change: the container-runner no longer self-exits when the last actor stops (on_destroy) or when a start fails on an otherwise-idle instance (on_start). It now stays warm and relies solely on the platform's SIGTERM (or the engine draining the /start connection after the request lifespan) to reap the instance. Docs/comments (README.md, main.rs, actor.rs) were updated consistently, no stale references to the old "exits when no actors remain" behavior found.

(Re-checked after the latest push. The commit content is unchanged from the previous review, just rebased/merged onto a newer base. Findings below still apply.)

Code quality

  • The removed if children().is_empty() { request_exit(...) } branches and the now-unused request_exit import in actor.rs are cleanly dropped. Logic is straightforward.
  • main.rs's async_main still has an else branch (non-signal EXIT cancellation, around main.rs:374-377) that the comment itself documents as unreachable today, since request_exit is only invoked by spawn_signal_handler. That's a fine documented fallback for a future actor-driven exit path, but since it's genuinely dead in practice, a tracing::warn! (or debug_assert!) on entry to that branch would make it loud if something unexpectedly triggers it instead of silently taking an untested code path.

Potential issues / things to double check

  • Test coverage gap (still present): container-runner/examples/e2e-test/host/run-host-tests.sh Scenario 6 (graceful actor stop, around lines 137-144) destroys the actor and then unconditionally calls stop_runner (kills the runner process) regardless of whether it already exited. Since this PR's entire purpose is changing the runner's self-exit behavior, none of the existing scenarios assert the process is still alive after the last actor is destroyed. Consider adding a kill -0 "$RUNNER_PID" check after destroy_actor (before stop_runner) in Scenario 6 to lock in the new "stays warm" behavior and catch regressions back to the old self-exit path.
  • Operational consideration (not a bug in this diff): the instance can no longer proactively drain itself when idle. Reclaiming an idle container now depends entirely on the engine closing the /start connection after the request lifespan, or an external SIGTERM arriving. If that signal is ever delayed or lost (engine bug, network partition, misconfigured lifespan), the container will now sit idle indefinitely instead of self-healing by exiting. Worth confirming the engine-side drain path is solid and monitored, since the failure mode shifted from "wasted exit" to "possible idle-resource leak."

Security / performance
No security-relevant surface touched (pure process-lifecycle logic, no new untrusted input handling). Performance impact is minor and net-positive for placement (avoids a cold start when the same instance is reused for the next actor).

Overall this is a reasonable, well-documented behavioral change; my main suggestion remains adding a host-test assertion that directly exercises the "stays warm" property this PR introduces.

@abcxff
abcxff force-pushed the stack/feat-container-runner-keep-instance-warm-instead-of-self-exiting-qqzrqpro branch from 7562a64 to ed6f3b4 Compare August 11, 2026 13:39
@abcxff
abcxff force-pushed the stack/chore-container-runner-default-stop-grace-to-10s-xnpvnuup branch from 48b59b1 to eb4decd Compare August 11, 2026 14:24
@abcxff
abcxff force-pushed the stack/feat-container-runner-keep-instance-warm-instead-of-self-exiting-qqzrqpro branch from ed6f3b4 to 65dce17 Compare August 11, 2026 14:24
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