Description
Description
When using the default perCommTarget
for commsOverSubshells
that was introduced in #17363 eveything works fine with a single kernel, but if a second kernel is started it tries to use the subshell of the first kernel for comms, which does not work.
Reproduce
- Check the
Kernel Comms over subshells
setting isOne subshell per comm-target
. This is the default so it should be this unless you have specifically changed it. - Open a new notebook and run this code in the first code cell:
from ipywidgets import IntSlider
IntSlider()
- Move the slider.
- Run
%subshell
in a new code cell, note that two subshells have been created. - Open a second notebook and repeat the actions (run code, move slider, run
%subshell
code). - Note that no subshells are created in the second kernel.
- Look at the terminal output of your
jupyter lab
command, it will show an error likeKeyError: 'e2b05f51-f9da-4eff-914d-8ebeebf886b5'
which contains asubshell_id
of the first kernel.
See screenshots below.
Context
Using latest commit (9dbdb1d) of main
branch, not browser or OS specific.
Screenshots from above

^^ First kernel works as expected, subshells created including e2b05f51-f9da-4eff-914d-8ebeebf886b5
.

^^ Second kernel does not create any new subshells.

^^ Terminal output shows second kernel trying to use subshell e2b05f51-f9da-4eff-914d-8ebeebf886b5
from first kernel.
The cause of the problem is that subshells cannot be shared between kernels, so the one subshell perCommTarget
should really be one subshell per kernel perCommTarget
. I have a fix underway for this and will submit a PR shortly.