Expand description
jupyter-server sidecar lifecycle: spawn, readiness, restart, group kill.
One sidecar per compute process, spawned in-process as a child in its
own process group (process_group(0)). Kernels, however, run in their
OWN sessions (jupyter_client launches them with
start_new_session=True), so a group SIGKILL reaches only the sidecar;
kernel cleanup is path-dependent:
- graceful shutdown (signals,
SupervisorHandle::shutdown) SIGTERMs the sidecar first — its own handler shuts kernels down — then group-SIGKILLs after [SHUTDOWN_GRACE]; - hard kills (handle Drop, readiness timeout) sweep
/procfor processes carryingJPY_PARENT_PID=<sidecar pid>and SIGKILL them ([kill_orphaned_kernels]).
With both, waratah stop leaves no orphaned Python. If the sidecar
dies on its own, it is restarted with capped exponential backoff and a
freshly picked port; readiness (sidecar answered GET /jupyter/api
with the token) is published on NotebookState so the proxy and
capability endpoints follow along.
Structs§
- Supervisor
Handle - Running sidecar supervisor.