Skip to content

gracefulShutdown

gracefulShutdown(kernel, ns, timeout): Promise<void>

Defined in: packages/runtime/src/platform/boot.ts:1144

Tear down a running kernel with a SIGTERM → grace → SIGKILL sequence.

Kernel

The kernel returned by createContainerKernel.

InterpretedNamespace

The namespace that kernel was built over.

number

Grace period in milliseconds between SIGTERM and SIGKILL.

Promise<void>

The canonical shutdown path. Snapshot running pids, SIGTERM all, race their exit promises against timeout, SIGKILL any survivors, await every exit promise, then call ns.dispose() (which disconnects bridge proxies and drops the kernel log). Used by both UnixInstance.shutdown and the container runtime’s internal shutdown path.

Not idempotent — ns.dispose() is called unconditionally at the end, so calling gracefulShutdown twice on the same namespace will disconnect already-disconnected proxies (harmless today, but not guaranteed).

UnixInstance.shutdown