ipython / ipykernel

IPython Kernel for Jupyter
https://ipykernel.readthedocs.io/en/stable/
BSD 3-Clause "New" or "Revised" License
654 stars 369 forks source link

Feature: Fork kernel #1261

Open zmbc opened 3 months ago

zmbc commented 3 months ago

Building on work by @maartenbreddels and @edisongustavo in #410, this is my first pass at trying to add the feature I requested in #1236.

The tests pass 🎉 However, this involved a fair amount of trial and error and I still don't fully understand why it works the way it does -- see comments inline. I would really appreciate some ideas here.

Requires a corresponding change to jupyter_client: https://github.com/jupyter/jupyter_client/pull/1031.

bluss commented 1 month ago

fork() unfortunately interacts very badly with threading (OS threads). Is it possible that the user has kicked off some running threads?

See also discussion https://discuss.python.org/t/switching-default-multiprocessing-context-to-spawn-on-posix-as-well/21868