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

use c.f.Future to wait across threads #940

Merged
merged 1 commit into from
Apr 7, 2023

Conversation

minrk
Copy link
Member

@minrk minrk commented Mar 29, 2023

Future allows us to propagate errors across threads, instead of threading.Event, which only waits forever and can result in uninformative hangs if there are errors.

this is related to spyder-ide/spyder#20381 where flush is being called on a closed stream, but the traceback doesn't track to the actual caller of channel.flush() because of how it's scheduled.

This shouldn't actually change the behavior, only improve error reporting when e.g. calling flush on a closed channel.

Alternately, we could choose to turn this error into a warning, which would in fact be a change in behavior.

Future allows us to propagate errors across threads,
instead of threading.Event, which only waits forever and can result in uninformative hangs if there are errors.
@ccordoba12
Copy link
Contributor

Alternately, we could choose to turn this error into a warning, which would in fact be a change in behavior.

I think it's better it's better to raise an error just to be sure that we're doing things as expected.

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.

Looks good to me, thanks @minrk!

Copy link
Contributor

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

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

Thank you!

@blink1073 blink1073 merged commit 98c87fe into jupyter:main Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants