jupyter / jupyter/notebook

WebSocketClosedError

Open
#2,834 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
13.3k
Forks
5.8k
Avg merge
6d 11h
Merged PRs (30d)
7

Description

I'm training Keras/Tensorflow models on my Ubuntu 14.04 LTS EC2 server running jupyter notebook.
I'm connecting to the jupyter server from my Mac OSX 10.11.6, from Safari 10.1.2.

It's getting 'WebSocketClosedError' errors.

I tried to set the c.ExecutePreprocessor.timeout, but it didn't help.
Anything else I can try to work around this issue?
```
ubuntu@ip-10-0-1-107:~$ echo "c.ExecutePreprocessor.timeout = $SECONDS" >> /home/ubuntu/.ipython/profile_default/ipython_nbconvert_config.py
ubuntu@ip-10-0-1-107:~$ chown ubuntu:ubuntu /home/ubuntu/.ipython/profile_default/ipython_nbconvert_config.py
ubuntu@ip-10-0-1-107:~$
ubuntu@ip-10-0-1-107:~$ vi /home/ubuntu/.ipython/profile_default/ipython_nbconvert_config.py
ubuntu@ip-10-0-1-107:~$ pwd
/home/ubuntu
ubuntu@ip-10-0-1-107:~$ jupyter notebook
[W 21:26:38.266 NotebookApp] Unrecognized JSON config file version, assuming version 1
[I 21:26:38.496 NotebookApp] JupyterLab alpha preview extension loaded from /home/ubuntu/anaconda/lib/python2.7/site-packages/jupyterlab
[I 21:26:38.506 NotebookApp] Serving notebooks from local directory: /home/ubuntu
[I 21:26:38.506 NotebookApp] 0 active kernels
[I 21:26:38.506 NotebookApp] The Jupyter Notebook is running at: https://[all ip addresses on your system]:8888/?token=b83af8c3b213a9696e8ec1fae6535075bbadd13c4e44af83
[I 21:26:38.506 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 21:26:38.507 NotebookApp]

Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
https://localhost:8888/?token=b83af8c3b213a9696e8ec1fae6535075bbadd13c4e44af83

[I 21:27:12.479 NotebookApp] 302 GET /?token=b83af8c3b213a9696e8ec1fae6535075bbadd13c4e44af83 (75.140.157.194) 0.61ms
[I 21:27:36.521 NotebookApp] Creating new notebook in
[I 21:27:38.167 NotebookApp] Kernel started: 6ee222d7-665a-42c4-b144-3d234d300e4a
[I 21:27:39.628 NotebookApp] Adapting to protocol v5.0 for kernel 6ee222d7-665a-42c4-b144-3d234d300e4a
2017-09-08 21:27:46.118570: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-09-08 21:27:46.118733: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-09-08 21:27:46.118793: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-09-08 21:27:46.118860: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2017-09-08 21:27:46.118920: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
[I 21:29:38.717 NotebookApp] Saving file at /Untitled3.ipynb
[W 21:53:39.629 NotebookApp] WebSocket ping timeout after 107910 ms.
[E 21:53:39.675 NotebookApp] Uncaught exception GET /api/kernels/6ee222d7-665a-42c4-b144-3d234d300e4a/channels?session_id=18857EA675AF4A65BAFD39E495C060B0 (75.140.157.194)
HTTPServerRequest(protocol='https', host='52.8.16.250:8888', method='GET', uri='/api/kernels/6ee222d7-665a-42c4-b144-3d234d300e4a/channels?session_id=18857EA675AF4A65BAFD39E495C060B0', version='HTTP/1.1', remote_ip='75.140.157.194', headers={'Origin': 'https://52.8.16.250:8888', 'Upgrade': 'websocket', 'Sec-Websocket-Extensions': 'x-webkit-deflate-frame', 'Sec-Websocket-Version': '13', 'Connection': 'Upgrade', 'Sec-Websocket-Key': 'zPm81YFrol5ukZ+DmJ5JKQ==', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8', 'Host': '52.8.16.250:8888', 'Cookie': '_xsrf=2|75ec6b90|49ec26caa2d08b2381e5121833c57f87|1502997123; username-52-8-16-250-8888="2|1:0|10:1504906032|25:username-52-8-16-250-8888|44:OGQ5ZDkyYjcxZjA5NGY1ZjkzNDlkYTBkNjdmMzVmNDY=|c7cee1b2bed7fbe6f5a9aa382268d408516a2b9ffbd33cb9ae71c2f8d1545302"; username-52-8-16-250-8889="2|1:0|10:1503435884|25:username-52-8-16-250-8889|44:OTdkZWFkMjE0MWVkNDdmZGI4ZDgzMmZhOGU1YzJiMmY=|0db22d15f6392e710dd45299ee022b3750210f9fbd2df88c04f48810a27c1bc6"', 'Pragma': 'no-cache', 'Cache-Control': 'no-cache'})
Traceback (most recent call last):
File "/home/ubuntu/anaconda/lib/python2.7/site-packages/tornado/web.py", line 1401, in _stack_context_handle_exception
raise_exc_info((type, value, traceback))
File "/home/ubuntu/anaconda/lib/python2.7/site-packages/tornado/stack_context.py", line 314, in wrapped
ret = fn(*args, **kwargs)
File "/home/ubuntu/anaconda/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 191, in
self.on_recv(lambda msg: callback(self, msg), copy=copy)
File "/home/ubuntu/anaconda/lib/python2.7/site-packages/notebook/services/kernels/handlers.py", line 373, in _on_zmq_reply
super(ZMQChannelsHandler, self)._on_zmq_reply(stream, msg)
File "/home/ubuntu/anaconda/lib/python2.7/site-packages/notebook/base/zmqhandlers.py", line 258, in _on_zmq_reply
self.write_message(msg, binary=isinstance(msg, bytes))
File "/home/ubuntu/anaconda/lib/python2.7/site-packages/tornado/websocket.py", line 215, in write_message
raise WebSocketClosedError()
WebSocketClosedError

```

Contributor guide

Open the contributing guide

Research direction

Start with the WebSocket traceback in notebook/services/kernels/handlers.py and notebook/base/zmqhandlers.py, then reproduce the long-running Keras/TensorFlow notebook execution described on Ubuntu EC2 from Safari. Determine the conditions causing the ping timeout and define done as preventing the reported WebSocketClosedError or documenting a confirmed workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, jupyter-notebook, python, tensorflow, ubuntu
Domain
backend, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.