Skip to content

Commit 66b038d

Browse files
committed
Fix shutdown
1 parent f924f8a commit 66b038d

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

ipykernel/kernelbase.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def __init__(self, **kwargs):
275275
self.control_handlers[msg_type] = getattr(self, msg_type)
276276

277277
self.control_queue: Queue[t.Any] = Queue()
278-
self.subshell_threads: dict[str, SubshellThread] = dict()
278+
self.subshell_threads: dict[str, SubshellThread] = {}
279279

280280
async def handle_main_shell(self):
281281
self.msg_queue: janus.Queue[t.Any] = janus.Queue()
@@ -890,9 +890,8 @@ async def shutdown_request(self, stream, ident, parent):
890890
control_io_loop = self.control_stream.io_loop
891891
control_io_loop.add_callback(control_io_loop.stop)
892892

893-
self.log.debug("Stopping shell ioloop")
894-
shell_io_loop = self.shell_stream.io_loop
895-
shell_io_loop.add_callback(shell_io_loop.stop)
893+
self.log.debug("Stopping main ioloop")
894+
self.io_loop.add_callback(self.io_loop.stop)
896895

897896
async def subshell_request(self, stream, ident, parent):
898897
shell_id = parent.get("content", {}).get("shell_id")

ipykernel/shell.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ async def handle_messages(msg_queue, kernel, is_main):
3232
# flush to ensure reply is sent before
3333
# handling the next request
3434
kernel.shell_stream.flush(zmq.POLLOUT)
35-
return
35+
continue
3636

3737
# Print some info about this message and leave a '--->' marker, so it's
3838
# easier to trace visually the message chain when debugging. Each
@@ -41,7 +41,7 @@ async def handle_messages(msg_queue, kernel, is_main):
4141
kernel.log.debug(" Content: %s\n --->\n ", msg["content"])
4242

4343
if not kernel.should_handle(kernel.shell_stream, msg, idents):
44-
return
44+
continue
4545

4646
handler = kernel.shell_handlers.get(msg_type, None)
4747
if handler is None:

0 commit comments

Comments
 (0)