Skip to content

Commit

Permalink
Merge pull request #3907 from kevin-bates/prevent-AttributeError-on-s…
Browse files Browse the repository at this point in the history
…hutdown

Prevent access through 'NoneType' when closing activity_stream
  • Loading branch information
minrk authored Sep 13, 2018
2 parents f81ec30 + 2d688f2 commit 8ced0dd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions notebook/services/kernels/kernelmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,9 @@ def shutdown_kernel(self, kernel_id, now=False):
"""Shutdown a kernel by kernel_id"""
self._check_kernel_id(kernel_id)
kernel = self._kernels[kernel_id]
kernel._activity_stream.close()
kernel._activity_stream = None
if kernel._activity_stream:
kernel._activity_stream.close()
kernel._activity_stream = None
self.stop_buffering(kernel_id)
self._kernel_connections.pop(kernel_id, None)
self.last_kernel_activity = utcnow()
Expand Down

0 comments on commit 8ced0dd

Please sign in to comment.