Skip to content

Commit 02fca62

Browse files
committed
Always close iopub socket
We sometime get ``` FAILED tests/test_connect.py::test_port_bind_failure_gives_up_retries - pytest.PytestUnraisableExceptionWarning: Exception ignored in: <function Socket.__del__ at 0x7efe22e4d760> Traceback (most recent call last): File "/opt/hostedtoolcache/Python/3.12.9/x64/lib/python3.12/site-packages/zmq/sugar/socket.py", line 185, in __del__ warn( ResourceWarning: Unclosed socket <zmq.asyncio.Socket(zmq.PUB) at 0x7efe1eb32820><F48> ``` The only zmq.PUB I can find is iopub, and we don't seem to be closing it In addition : should app be a contextmanager ? And should the atexit close registring be replaced with a weakref finalizer ? t
1 parent 4d42cb8 commit 02fca62

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ipykernel/kernelapp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ def close(self):
427427
if self.debug_shell_socket and not self.debug_shell_socket.closed:
428428
self.debug_shell_socket.close()
429429

430-
for channel in ("shell", "control", "stdin"):
430+
for channel in ("shell", "control", "stdin", "iopub"):
431431
self.log.debug("Closing %s channel", channel)
432432
socket = getattr(self, channel + "_socket", None)
433433
if socket and not socket.closed:

0 commit comments

Comments
 (0)