{ } Raw JSON

bundles / ipykernel 7.3.0 / ipykernel / thread / make_selector_io_loop

function

ipykernel.thread:make_selector_io_loop

source: /ipykernel/thread.py:13

Signature

def make_selector_io_loop() → IOLoop

Summary

Create a non-current tornado IOLoop for an ipykernel service thread.

Extended Summary

ipykernel runs its service channels -- control, IOPub, the shell channel and subshells -- on dedicated event loops in background threads. The process-wide asyncio loop on Windows is a ProactorEventLoop (so the main user-code loop can spawn asyncio subprocesses, see #1468/#1469), and Proactor has no native add_reader. Tornado therefore drives a Proactor loop's zmq sockets through a helper "Tornado selector" thread. When a debugger suspends every thread at a breakpoint on Python >= 3.12 (sys.monitoring), that un-exempt helper thread freezes mid-wake and deadlocks the control/debug read path (#1469).

These service loops never need Proactor's subprocess support, so we keep them on a SelectorEventLoop: it implements add_reader natively and needs no helper thread. Only the main/user-code loop stays on Proactor. On non-Windows platforms the default loop is already selector-based, so this is a no-op there.

Aliases

  • ipykernel.iostream.make_selector_io_loop