Skip to content

Commit 5f71eaa

Browse files
committed
fix: handle kernel abort requests gracefully in message processing
1 parent 17ebe6b commit 5f71eaa

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ipykernel/kernelbase.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,11 +440,14 @@ async def _execute_request_handler(self, receive_stream):
440440
async with receive_stream:
441441
async for handler, (socket, idents, msg) in receive_stream:
442442
try:
443+
if self._aborting:
444+
await self._send_abort_reply(socket, msg, idents)
445+
continue
443446
result = handler(socket, idents, msg)
444447
self.set_parent(idents, msg, channel="shell")
445448
if inspect.isawaitable(result):
446449
await result
447-
except Exception as e:
450+
except BaseException as e:
448451
self.log.exception("Execute request", exc_info=e)
449452

450453
async def process_shell(self, socket, send_stream):

0 commit comments

Comments
 (0)