fix(kernel): interrupt IPython subprocess groups - #1030
Closed
lucasrgt wants to merge 1 commit into
Closed
Conversation
Contributor
|
Thank you for the report and proposed work. This root cause is now covered by maintainer-owned stacked PR #1162, authored independently from We did not inspect or reuse this PR's diff, branch, commits, implementation code, or tests; its public description/comments were used only as a bug report. To keep one review surface, this PR is superseded by #1162 and is being closed. The complete review stack is #1158–#1165. It is being left unmerged for human review after CI and review-bot findings are cleared. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes interrupted IPython cells that stay busy until a subprocess naturally exits.
Prime Agent currently launches direct and forked kernels inside the daemon process group. ipykernel deliberately forwards
interrupt_requestto descendants only when the kernel is its process-group leader; otherwise it signals the kernel PID alone. Commands such asos.system()/subprocess.wait()can therefore leave their child running while the kernel stays occupied for minutes.Changes
detached: trueso each kernel owns a session/process groupsetsid()in forkserver kernel children before starting ipykernelWindows retains the existing behavior.
Validation
npm run checkThe regression test launches a sleeping subprocess, aborts the cell, verifies kernel PID == PGID, and proves a follow-up cell completes instead of raising
KernelBusyAfterInterruptError.Note
Fix interrupt handling in IPython kernels to signal full process groups
detached: trueso they become process-group leaders; forked kernels callos.setsid()for the same effect.killIsolatedKernelProcessGroupin index.ts andterminateForkedKernelin fork-server.ts with fallback to direct PID signaling when the group is not yet established.Macroscope summarized 8dcfff8.