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

Make sure kernel is cleaned up in case an error occurred while starting kernel client #234

Conversation

CiprianAnton
Copy link
Contributor

In case an error happens in start_channels(), the kernel is never cleaned up, leading to leaks. For e.g., in GatewayKernelClient there is a chance we get ConnectionError.

Another place to ensure cleanup is in setup_kernel, however, since async_start_new_kernel_client already performs cleanup in case of timeout, I think it's a better fit here.

Added test to cover this. All tests passed locally.

Copy link
Member

@davidbrochart davidbrochart left a comment

Choose a reason for hiding this comment

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

Thanks a lot @CiprianAnton!
Let's just pin traitlets<5.2.0 for now, until ipython/traitlets#736 is fixed.
cc @blink1073

@davidbrochart davidbrochart force-pushed the users/canton/ensure-cleanup-in-case-of-kc-errors branch from 52d9edc to 95b26f0 Compare May 31, 2022 21:33
@davidbrochart davidbrochart force-pushed the users/canton/ensure-cleanup-in-case-of-kc-errors branch from f3dd8ff to f9b48f1 Compare May 31, 2022 22:01
@davidbrochart
Copy link
Member

traitlets v5.2.2 was released.
I added some type:ignore for now because we need to have a better solution in jupyter_client so that a KernelClient has a complete API. Currently only the subclasses BlockingKernelClient and AsyncKernelClient have a complete API, but it's hard to reconcile in KernelClient because methods can be async or not.

@davidbrochart davidbrochart merged commit 01465b8 into jupyter:main May 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants