Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ We strongly recommend that you upgrade pip to version 9+ of pip before upgrading
Use ``pip install pip --upgrade`` to upgrade pip. Check pip version with
``pip --version``.

.. _release-5.7.7:

5.7.7
-----

- Fix regression in restarting kernels in 5.7.5.
The restart handler would return before restart was completed.
- Further improve compatibility with tornado 6 with improved
checks for when websockets are closed.
- Fix regression in 5.7.6 on Windows where .js files could have the wrong mime-type.

.. _release-5.7.6:

5.7.6
Expand Down
18 changes: 15 additions & 3 deletions notebook/base/zmqhandlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

import tornado
from tornado import gen, ioloop, web
from tornado.websocket import WebSocketHandler
from tornado.iostream import StreamClosedError
from tornado.websocket import WebSocketHandler, WebSocketClosedError

from jupyter_client.session import Session
from jupyter_client.jsonutil import date_default, extract_dates
Expand Down Expand Up @@ -185,8 +186,13 @@ def send_ping(self):
self.log.warning("WebSocket ping timeout after %i ms.", since_last_pong)
self.close()
return
try:
self.ping(b'')
except (StreamClosedError, WebSocketClosedError):
# websocket has been closed, stop pinging
self.ping_callback.stop()
return

self.ping(b'')
self.last_ping = now

def on_pong(self, data):
Expand Down Expand Up @@ -246,8 +252,14 @@ def _on_zmq_reply(self, stream, msg_list):
msg = self._reserialize_reply(msg_list, channel=channel)
except Exception:
self.log.critical("Malformed message: %r" % msg_list, exc_info=True)
else:
return

try:
self.write_message(msg, binary=isinstance(msg, bytes))
except (StreamClosedError, WebSocketClosedError):
self.log.warning("zmq message arrived on closed channel")
self.close()
return


class AuthenticatedZMQStreamHandler(ZMQStreamHandler, IPythonHandler):
Expand Down
3 changes: 2 additions & 1 deletion notebook/services/kernels/kernelmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,8 @@ def on_restart_failed():
channel.on_recv(on_reply)
loop = IOLoop.current()
timeout = loop.add_timeout(loop.time() + self.kernel_info_timeout, on_timeout)
raise gen.Return(future)
# wait for restart to complete
yield future

def notify_connect(self, kernel_id):
"""Notice a new connection to a kernel"""
Expand Down