Update 6.4.x branch with some missing commits (#6308)

Co-authored-by: GitHub Action <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Vishwajeet <33215443+Vishwajeet0510@users.noreply.github.com>
Co-authored-by: Kevin Bates <kbates4@gmail.com>
This commit is contained in:
Kyle Cutler 2022-03-14 03:38:00 -07:00 committed by GitHub
parent 52581f8eda
commit 3cd1de8aa6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 6 deletions

View File

@ -14,6 +14,22 @@ Use `pip install pip --upgrade` to upgrade pip. Check pip version with
<!-- <START NEW CHANGELOG ENTRY> --> <!-- <START NEW CHANGELOG ENTRY> -->
## 6.4.8
([Full Changelog](https://github.com/jupyter/notebook/compare/v6.4.7...479902d83a691253e0cff8439a33577e82408317))
### Bugs fixed
- Fix to remove potential memory leak on Jupyter Notebooks ZMQChannelHandler code [#6251](https://github.com/jupyter/notebook/pull/6251) ([@Vishwajeet0510](https://github.com/Vishwajeet0510))
### Contributors to this release
([GitHub contributors page for this release](https://github.com/jupyter/notebook/graphs/contributors?from=2022-01-12&to=2022-01-25&type=c))
[@Vishwajeet0510](https://github.com/search?q=repo%3Ajupyter%2Fnotebook+involves%3AVishwajeet0510+updated%3A2022-01-12..2022-01-25&type=Issues)
<!-- <END NEW CHANGELOG ENTRY> -->
## 6.4.7 ## 6.4.7
([Full Changelog](https://github.com/jupyter/notebook/compare/v6.4.6...b77b5e38b8fa1a20150d7fa4d735dbf1c4f00418)) ([Full Changelog](https://github.com/jupyter/notebook/compare/v6.4.6...b77b5e38b8fa1a20150d7fa4d735dbf1c4f00418))
@ -40,8 +56,6 @@ Use `pip install pip --upgrade` to upgrade pip. Check pip version with
[@antoinecarme](https://github.com/search?q=repo%3Ajupyter%2Fnotebook+involves%3Aantoinecarme+updated%3A2021-11-16..2022-01-12&type=Issues) | [@blink1073](https://github.com/search?q=repo%3Ajupyter%2Fnotebook+involves%3Ablink1073+updated%3A2021-11-16..2022-01-12&type=Issues) | [@ccw630](https://github.com/search?q=repo%3Ajupyter%2Fnotebook+involves%3Accw630+updated%3A2021-11-16..2022-01-12&type=Issues) | [@kevin-bates](https://github.com/search?q=repo%3Ajupyter%2Fnotebook+involves%3Akevin-bates+updated%3A2021-11-16..2022-01-12&type=Issues) | [@LiHua-Official](https://github.com/search?q=repo%3Ajupyter%2Fnotebook+involves%3ALiHua-Official+updated%3A2021-11-16..2022-01-12&type=Issues) | [@penguinolog](https://github.com/search?q=repo%3Ajupyter%2Fnotebook+involves%3Apenguinolog+updated%3A2021-11-16..2022-01-12&type=Issues) | [@tornaria](https://github.com/search?q=repo%3Ajupyter%2Fnotebook+involves%3Atornaria+updated%3A2021-11-16..2022-01-12&type=Issues) [@antoinecarme](https://github.com/search?q=repo%3Ajupyter%2Fnotebook+involves%3Aantoinecarme+updated%3A2021-11-16..2022-01-12&type=Issues) | [@blink1073](https://github.com/search?q=repo%3Ajupyter%2Fnotebook+involves%3Ablink1073+updated%3A2021-11-16..2022-01-12&type=Issues) | [@ccw630](https://github.com/search?q=repo%3Ajupyter%2Fnotebook+involves%3Accw630+updated%3A2021-11-16..2022-01-12&type=Issues) | [@kevin-bates](https://github.com/search?q=repo%3Ajupyter%2Fnotebook+involves%3Akevin-bates+updated%3A2021-11-16..2022-01-12&type=Issues) | [@LiHua-Official](https://github.com/search?q=repo%3Ajupyter%2Fnotebook+involves%3ALiHua-Official+updated%3A2021-11-16..2022-01-12&type=Issues) | [@penguinolog](https://github.com/search?q=repo%3Ajupyter%2Fnotebook+involves%3Apenguinolog+updated%3A2021-11-16..2022-01-12&type=Issues) | [@tornaria](https://github.com/search?q=repo%3Ajupyter%2Fnotebook+involves%3Atornaria+updated%3A2021-11-16..2022-01-12&type=Issues)
<!-- <END NEW CHANGELOG ENTRY> -->
## 6.4.6 ## 6.4.6
([Full Changelog](https://github.com/jupyter/notebook/compare/v6.4.5...160c27d3c23dafe8b42240571db21b0d5cbae2fe)) ([Full Changelog](https://github.com/jupyter/notebook/compare/v6.4.5...160c27d3c23dafe8b42240571db21b0d5cbae2fe))

View File

@ -138,7 +138,7 @@ class ZMQChannelsHandler(AuthenticatedZMQStreamHandler):
"""Nudge the zmq connections with kernel_info_requests """Nudge the zmq connections with kernel_info_requests
Returns a Future that will resolve when we have received Returns a Future that will resolve when we have received
a shell reply and at least one iopub message, a shell or control reply and at least one iopub message,
ensuring that zmq subscriptions are established, ensuring that zmq subscriptions are established,
sockets are fully connected, and kernel is responsive. sockets are fully connected, and kernel is responsive.
@ -157,10 +157,12 @@ class ZMQChannelsHandler(AuthenticatedZMQStreamHandler):
f = Future() f = Future()
f.set_result(None) f.set_result(None)
return f return f
# Use a transient shell channel to prevent leaking # Use a transient shell channel to prevent leaking
# shell responses to the front-end. # shell responses to the front-end.
shell_channel = kernel.connect_shell() shell_channel = kernel.connect_shell()
# Use a transient control channel to prevent leaking
# control responses to the front-end.
control_channel = kernel.connect_control()
# The IOPub used by the client, whose subscriptions we are verifying. # The IOPub used by the client, whose subscriptions we are verifying.
iopub_channel = self.channels["iopub"] iopub_channel = self.channels["iopub"]
@ -183,6 +185,8 @@ class ZMQChannelsHandler(AuthenticatedZMQStreamHandler):
iopub_channel.stop_on_recv() iopub_channel.stop_on_recv()
if not shell_channel.closed(): if not shell_channel.closed():
shell_channel.close() shell_channel.close()
if not control_channel.closed():
control_channel.close()
# trigger cleanup when both message futures are resolved # trigger cleanup when both message futures are resolved
both_done.add_done_callback(cleanup) both_done.add_done_callback(cleanup)
@ -193,6 +197,12 @@ class ZMQChannelsHandler(AuthenticatedZMQStreamHandler):
self.log.debug("Nudge: resolving shell future: %s", self.kernel_id) self.log.debug("Nudge: resolving shell future: %s", self.kernel_id)
info_future.set_result(None) info_future.set_result(None)
def on_control_reply(msg):
self.log.debug("Nudge: control info reply received: %s", self.kernel_id)
if not info_future.done():
self.log.debug("Nudge: resolving control future: %s", self.kernel_id)
info_future.set_result(None)
def on_iopub(msg): def on_iopub(msg):
self.log.debug("Nudge: IOPub received: %s", self.kernel_id) self.log.debug("Nudge: IOPub received: %s", self.kernel_id)
if not iopub_future.done(): if not iopub_future.done():
@ -202,6 +212,7 @@ class ZMQChannelsHandler(AuthenticatedZMQStreamHandler):
iopub_channel.on_recv(on_iopub) iopub_channel.on_recv(on_iopub)
shell_channel.on_recv(on_shell_reply) shell_channel.on_recv(on_shell_reply)
control_channel.on_recv(on_control_reply)
loop = IOLoop.current() loop = IOLoop.current()
# Nudge the kernel with kernel info requests until we get an IOPub message # Nudge the kernel with kernel info requests until we get an IOPub message
@ -227,6 +238,12 @@ class ZMQChannelsHandler(AuthenticatedZMQStreamHandler):
# check for closed zmq socket # check for closed zmq socket
if shell_channel.closed(): if shell_channel.closed():
self.log.debug("Nudge: cancelling on closed zmq socket: %s", self.kernel_id)
finish()
return
# check for closed zmq socket
if control_channel.closed():
self.log.debug( self.log.debug(
"Nudge: cancelling on closed zmq socket: %s", self.kernel_id "Nudge: cancelling on closed zmq socket: %s", self.kernel_id
) )
@ -237,6 +254,7 @@ class ZMQChannelsHandler(AuthenticatedZMQStreamHandler):
log = self.log.warning if count % 10 == 0 else self.log.debug log = self.log.warning if count % 10 == 0 else self.log.debug
log("Nudge: attempt %s on kernel %s" % (count, self.kernel_id)) log("Nudge: attempt %s on kernel %s" % (count, self.kernel_id))
self.session.send(shell_channel, "kernel_info_request") self.session.send(shell_channel, "kernel_info_request")
self.session.send(control_channel, "kernel_info_request")
nonlocal nudge_handle nonlocal nudge_handle
nudge_handle = loop.call_later(0.5, nudge, count) nudge_handle = loop.call_later(0.5, nudge, count)
@ -371,6 +389,7 @@ class ZMQChannelsHandler(AuthenticatedZMQStreamHandler):
if stale_handler: if stale_handler:
self.log.warning("Replacing stale connection: %s", self.session_key) self.log.warning("Replacing stale connection: %s", self.session_key)
yield stale_handler.close() yield stale_handler.close()
if self.kernel_id in self.kernel_manager: # only update open sessions if kernel is actively managed
self._open_sessions[self.session_key] = self self._open_sessions[self.session_key] = self
def open(self, kernel_id): def open(self, kernel_id):

View File

@ -73,7 +73,7 @@ define(function(){
// tree // tree
jglobal('SessionList','tree/js/sessionlist'); jglobal('SessionList','tree/js/sessionlist');
Jupyter.version = "6.4.7"; Jupyter.version = "6.4.8";
Jupyter._target = '_blank'; Jupyter._target = '_blank';
return Jupyter; return Jupyter;