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

Prevent access through 'NoneType' when closing activity_stream #3907

Merged
merged 1 commit into from Sep 13, 2018

Conversation

Projects
None yet
2 participants
@kevin-bates
Contributor

kevin-bates commented Sep 11, 2018

Although I'm unable to reproduce the issue, its a safe change to
prevent an AttributeError from occuring ('NoneType' object has no
attribute 'close'). The user that reported this is attempting to
launch a kernel and I believe the launch only partially completed
such that kernel._activity_stream did not get established.
(This occurred from Jupyter Enterprise Gateway where we deal with remote
kernel launches across resource-managed clusters, so things are a bit
more involved relative to kernel establishment.)

Here's the traceback that occurs without this change...

[E 2018-09-10 17:31:18.897 EnterpriseGatewayApp] The following exception was encountered while checking the idle duration of kernel 389e11d9-f354-4113-8cdc-a34da14cee50: 'NoneType' object has no attribute 'close'
    Traceback (most recent call last):
      File "/opt/anaconda3/lib/python3.6/site-packages/notebook/services/kernels/kernelmanager.py", line 415, in cull_kernels
        self.cull_kernel_if_idle(kernel_id)
      File "/opt/anaconda3/lib/python3.6/site-packages/notebook/services/kernels/kernelmanager.py", line 436, in cull_kernel_if_idle
        self.shutdown_kernel(kernel_id)
      File "/opt/anaconda3/lib/python3.6/site-packages/notebook/services/kernels/kernelmanager.py", line 263, in shutdown_kernel
        kernel._activity_stream.close()
    AttributeError: 'NoneType' object has no attribute 'close'
Prevent access through 'NoneType' when closing activity_stream
Although I'm unable to reproduce the issue, its a safe change to
prevent an AttributeError from occuring ('NoneType' object has no
attribute 'close').  The user that reported this is attempting to
launch a kernel and I believe the launch only partially completed
such that `kernel._activity_stream` did not get established.
(This occurred from Jupyter Enterprise Gateway where we deal with remote
kernel launches across resource-managed clusters, so things are a bit
more involved relative to kernel establishment.)

@minrk minrk merged commit 8ced0dd into jupyter:master Sep 13, 2018

4 checks passed

codecov/patch 100% of diff hit (target 0%)
Details
codecov/project 73.75% (+<.01%) compared to 872a6c7
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@minrk minrk added this to the 5.7 milestone Sep 13, 2018

@minrk

This comment has been minimized.

Member

minrk commented Sep 13, 2018

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment