Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ThreadedZMQStream: close stream before socket #936

Merged
merged 2 commits into from
Mar 19, 2023

Conversation

minrk
Copy link
Member

@minrk minrk commented Mar 16, 2023

not just the underlying socket, because the stream represents event listeners on the socket, and can produce errors or at least warnings if the socket is closed before being unregistered. Or worst case, continue to register the wrong callbacks on a subsequent socket if it uses the freed FD before it's noticed.

related to spyder-ide/spyder#20381

@minrk minrk added the bug label Mar 16, 2023
@minrk minrk changed the title ThreadedZMQStream: close stream when it's done ThreadedZMQStream: close stream before socket Mar 16, 2023
not just the underlying socket,
because the stream represents event listeners on the socket,
and can produce errors or at least warnings if the socket is closed before being unregistered

self.ioloop.add_callback(close_stream)
try:
f.result(timeout=5)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pattern should prevent hangs in case of errors where we use Event.wait() without timeouts elsewhere in this file.

Copy link
Contributor

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small fix in a docstring, the rest looks good to me. Thanks @minrk!

jupyter_client/threaded.py Outdated Show resolved Hide resolved
Co-authored-by: Carlos Cordoba <ccordoba12@gmail.com>
@blink1073
Copy link
Contributor

Thanks! I'll cut a release tomorrow.

@blink1073 blink1073 merged commit e3ac7a6 into jupyter:main Mar 19, 2023
@minrk minrk deleted the close-stream branch March 20, 2023 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants