Fork-server beforeExit cleanup can orphan live kernels from their Prime host #1477
tamikomssi
started this conversation in
Bug reports
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem
On Linux, Prime Agent keeps a shared Python fork-server template alive for the worker process and forks IPython kernels from it.
registerForkServerCleanupOnce()currently disposes that template on NodebeforeExitas well as actual teardown.beforeExitis an idle event-loop boundary, not proof that the Prime worker is terminating. If later daemon work keeps or resumes the worker, disposing the template kills the forked kernel's parent while the kernel remains live. The kernel is then reparented outside the Prime worker ancestry. Local tools that correctly authorize the real Prime host through exact process ancestry can no longer identify it.Reproduction
A focused process-topology test launches a template plus a live child, records the child's PPID, emits
beforeExit, and observes the template PID. With the current registration, the template exits withESRCHon the liveness probe while the child survives.Operational evidence is tracked in pi-coordination #77.
Narrow fix
Do not dispose the process-lived template on
beforeExit. Keep existing cleanup onexit,SIGINT,SIGTERM, and explicit process-wide resource teardown. This does not change the fork-server protocol or any authorization behavior.A validated implementation is available in the owner's operational fork at commit
41dfc5a74d0a. The regression fails with the original handler and passes after the change; the package's focused test and repositorynpm run checkpass. Per this repository's contribution policy, this Discussion is the upstream intake follow-up; no upstream pull request will be opened without maintainer invitation.All reactions