xeus-python icon indicating copy to clipboard operation
xeus-python copied to clipboard

python comm crashes XPython kernel

Open albop opened this issue 4 months ago • 4 comments

Here is how to reproduce it:

  • Setup the environment
pixi init
pixi add xeus-python jupyterlab
pixi run jupyter lab
  • Then create a jupyter notebook using kernel XPython
  • Run a single cell with content:
from comm import Comm
comm = Comm(target_name="test2")

The result is a kernel crash. I'm on linux.

albop avatar Oct 02 '25 11:10 albop

I recall this was fixed in upstream xeus as part of the comms refactor. But these changes are not used by xeus-python yet

If I'm correct, this is the byproduct of missing the comm target registering. As in, before you can create a comm with this target, you need register the target.

import comm

def handle_comm_opened(*args, **kwargs):
    # TODO handle comm open from front-end
    pass


comm_manager = comm.get_comm_manager()
if comm_manager is not None:
    comm_manager.register_target("test2", handle_comm_opened)

martinRenou avatar Oct 02 '25 13:10 martinRenou

You mean it is fixed in this PR ?

JohanMabille avatar Oct 02 '25 13:10 JohanMabille

That's what I recall from past discussion we had, though I may be wrong.

The problem is when we try to create a comm with a non-registered target, it crashes instead of failing with a nice error message.

martinRenou avatar Oct 02 '25 13:10 martinRenou

I've just tested, it fixes the problem.

JohanMabille avatar Oct 03 '25 09:10 JohanMabille