Uh oh!
There was an error while loading. Please reload this page.
Try to debug non-closed iopub socket - #1345
Conversation
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
Carreau
commented
Feb 18, 2025
Ah ! No, in the real application the iopub_socket is closed when you close the thread, but in conftest it is not ! |
Carreau
commented
Feb 18, 2025
well, in conf.py it is also closed... |
Carreau
commented
Feb 18, 2025
@minrk do you believe that using tracemalloc in the del in pyzmq to print where the socket was created could help and would you accept a PR ? |
minrk
commented
Feb 19, 2025
@Carreau 100%! I thought you had to |
Carreau
commented
Feb 19, 2025
I think you need both ? My understanding is that Maybe I'm wrong. |
Seem that you are right it shoudl show up automatically. I will try differently. |
Carreau
commented
Feb 19, 2025
Thanks for the review. I'm going to merge and hope it triggers a more helpful error message soon. |
We sometime get
This adds a tracemalloc fixture for the crashing test module in order to try to narrow that down. I'm thorn between restart the tests here until we have the failure; or merge and see once we get the error in another PR and then remove the fixture once we've fund the culprit.
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 ?