Skip to content

Commit ac93dd8

Browse files
authored
Do not log connection error if the kernel is already shutdown (#584)
I had the following error locally: ``` [Voila] Kernel shutdown: c7f832d5-6b46-4f77-9f98-f0b9ca6e7ac8 [Voila] WARNING | Timeout waiting for kernel_info reply from c7f832d5-6b46-4f77-9f98-f0b9ca6e7ac8 [Voila] ERROR | Error opening stream: HTTP 404: Not Found (Kernel does not exist: c7f832d5-6b46-4f77-9f98-f0b9ca6e7ac8) ``` This was because I closed the Voila application before the client could finish connecting to the kernel. With this PR, it should shutdown the kernel properly and be silent after not being able to connect.
1 parent 67cdb6b commit ac93dd8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

jupyter_server/services/kernels/handlers.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,14 @@ def replay(value):
392392
self.create_stream()
393393
connected = self.nudge()
394394
except web.HTTPError as e:
395-
self.log.error("Error opening stream: %s", e)
395+
# Do not log error if the kernel is already shutdown,
396+
# as it's normal that it's not responding
397+
try:
398+
self.kernel_manager.get_kernel(kernel_id)
399+
400+
self.log.error("Error opening stream: %s", e)
401+
except KeyError:
402+
pass
396403
# WebSockets don't respond to traditional error codes so we
397404
# close the connection.
398405
for channel, stream in self.channels.items():

0 commit comments

Comments
 (0)