Skip to content

Using a subshell perCommTarget fails if using more than one kernel #17633

Closed
@ianthomas23

Description

@ianthomas23

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

  1. Check the Kernel Comms over subshells setting is One subshell per comm-target. This is the default so it should be this unless you have specifically changed it.
  2. Open a new notebook and run this code in the first code cell:
from ipywidgets import IntSlider
IntSlider()
  1. Move the slider.
  2. Run %subshell in a new code cell, note that two subshells have been created.
  3. Open a second notebook and repeat the actions (run code, move slider, run %subshell code).
  4. Note that no subshells are created in the second kernel.
  5. Look at the terminal output of your jupyter lab command, it will show an error like KeyError: 'e2b05f51-f9da-4eff-914d-8ebeebf886b5' which contains a subshell_id of the first kernel.

See screenshots below.

Context

Using latest commit (9dbdb1d) of main branch, not browser or OS specific.

Screenshots from above

Image

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

Image

^^ Second kernel does not create any new subshells.

Image

^^ 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions