Repository navigation
Backport ipykernel's shell channel wedge fix for ipykernel 7.0 to 7.3 - #16787
Closed
testlabauto wants to merge 2 commits into
Closed
testlabauto wants to merge 2 commits into
testlabauto wants to merge 2 commits into
Conversation
ipykernel 7.0 to 7.3 send shell replies raw on the shell socket, which can drain its read edge and strand a concurrently queued request, wedging the kernel. Route replies through the shell ZMQStream instead, as ipykernel 7.4.0 does (ipython/ipykernel#1529). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Contributor
|
E2E Tests 🚀 Why these tags?
More on automatic tags from changed files. |
… control test The type check job installs the bundled ipykernel 6.31.0, which has no shell channel modules, so mark those imports for pyright. The stock-path control test did not strand on Windows, so keep only the positive assertion, as upstream's regression test does. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
austin3dickey
requested changes
Oct 21, 2026
austin3dickey
left a comment
Contributor
There was a problem hiding this comment.
As discussed in Slack, I think this is too much maintenance for a small edge case. Someone would have to be using an EOL Python and opting out of the bundled ipykernel to encounter this.
Contributor
Author
|
Closing due to concerns. Will fix issue with a python version bump in all the images and workflows instead, |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes #15060
Summary
The wedge in #15060 is an ipykernel bug. ipykernel 7.0 to 7.3 read the shell ROUTER socket with a
ZMQStreamon the shell channel thread, but send replies with a rawsend_multiparton the same socket. The raw send drains the socket's edge-triggered read edge without the stream noticing. A request that arrived at the same time is then never read, and the kernel goes silent at 0% CPU. ipykernel 7.4.0 fixes this by sending replies through the stream (ipython/ipykernel#1529), but 7.4.0 requires Python 3.11.Positron's bundled ipykernel 6.31.0 is not affected. After #16541 moved the main console spec back to the bundled kernel, that spec went from 19 failures in 685 runs to 0 in the runs that include the fix. The alternate-ipykernel spec still loads the CI image's Python 3.10 with ipykernel 7.3.0 and kept wedging (6 of 114 runs), so it is the end-to-end regression check for this change.
This PR backports the upstream fix inside Positron's kernel, for users whose session loads ipykernel 7.0 to 7.3 (for example with
python.useBundledIpykerneloff):positron/shell_channel.pyadds aShellChannelThreadsubclass whose subshell manager sends replies through the shellZMQStream.PositronIPKernelApp.init_controlswaps that thread in before it starts, andinit_kernelhands it the stream. The swap is gated on the installed ipykernel version, so ipykernel 6.x and 7.4+ are unchanged.tests/test_shell_channel.pyis adapted from the upstream regression test. It creates the strand condition deterministically and checks that Positron's thread still delivers the queued request after the reply send. It skips on ipykernel versions outside 7.0 to 7.3.Checked in the real kernel app on ipykernel 7.3.0 that the Positron thread is the one wired in. Ruff, pyright, the existing kernel and UI test suites, and precommit pass.
Release Notes
New Features
Bug Fixes
Validation Steps
@:console @:web @:win
The
Console Pane: Alternate Pythonspec is the regression check. It runs the CI image's Python 3.10 with ipykernel 7.3.0.To check by hand:
python.useBundledIpykerneltofalse.ipykernel==7.3.0installed.type(get_ipython().kernel.shell_channel_thread).__name__. The result isPositronShellChannelThread.The Python kernel unit tests on 3.9 and 3.10 also run the new test, since those versions resolve to ipykernel 7.3.0.
🤖 Generated with Claude Code