[ConfigProxy] error: 503 socket hang up

Installed jupyterhub in a docker container and trying to run in cloud. but i am getting this error. Been through tons of such post and tried all of them and yet i am having this issue. The same docker container in my local system works fine. How do i fix this?

Your personal set up

  • OS: ubuntu 16.04
  • Version(s):
  • jupyterhub --version
    1.3.0

jupyter --version
jupyter core : 4.7.1
jupyter-notebook : 6.2.0
qtconsole : 5.0.3
ipython : 7.21.0
ipykernel : 5.5.0
jupyter client : 6.1.12
jupyter lab : 3.0.12
nbconvert : 6.0.7
ipywidgets : 7.6.3
nbformat : 5.1.2
traitlets : 5.0.5

  • Full environment
# paste output of `pip freeze` or `conda list` here
- alembic @ file:///tmp/wheelhouse/alembic-1.4.3-py2.py3-none-any.whl
anyio==2.2.0
argon2-cffi==20.1.0
async-generator @ file:///tmp/wheelhouse/async_generator-1.10-py3-none-any.whl
attrs @ file:///tmp/wheelhouse/attrs-20.3.0-py2.py3-none-any.whl
Babel==2.9.0
backcall==0.2.0
bleach==3.3.0
certifi @ file:///tmp/wheelhouse/certifi-2020.12.5-py2.py3-none-any.whl
certipy @ file:///tmp/wheelhouse/certipy-0.1.3-py3-none-any.whl
cffi @ file:///tmp/wheelhouse/cffi-1.14.4-cp38-cp38-manylinux1_x86_64.whl
chardet @ file:///tmp/wheelhouse/chardet-3.0.4-py2.py3-none-any.whl
cryptography @ file:///tmp/wheelhouse/cryptography-3.3.1-cp36-abi3-manylinux2010_x86_64.whl
decorator==4.4.2
defusedxml==0.7.1
entrypoints @ file:///tmp/wheelhouse/entrypoints-0.3-py2.py3-none-any.whl
idna @ file:///tmp/wheelhouse/idna-2.10-py2.py3-none-any.whl
ipykernel==5.5.0
ipython==7.21.0
ipython-genutils @ file:///tmp/wheelhouse/ipython_genutils-0.2.0-py2.py3-none-any.whl
ipywidgets==7.6.3
jedi==0.18.0
Jinja2 @ file:///tmp/wheelhouse/Jinja2-2.11.2-py2.py3-none-any.whl
json5==0.9.5
jsonschema @ file:///tmp/wheelhouse/jsonschema-3.2.0-py2.py3-none-any.whl
jupyter==1.0.0
jupyter-client==6.1.12
jupyter-console==6.3.0
jupyter-core==4.7.1
jupyter-packaging==0.7.12
jupyter-server==1.4.1
jupyter-telemetry @ file:///tmp/wheelhouse/jupyter_telemetry-0.1.0-py3-none-any.whl
jupyterhub @ file:///tmp/wheelhouse/jupyterhub-1.3.0-py3-none-any.whl
jupyterlab==3.0.12
jupyterlab-pygments==0.1.2
jupyterlab-server==2.3.0
jupyterlab-widgets==1.0.0
Mako @ file:///tmp/wheelhouse/Mako-1.1.3-py2.py3-none-any.whl
MarkupSafe @ file:///tmp/wheelhouse/MarkupSafe-1.1.1-cp38-cp38-manylinux1_x86_64.whl
mistune==0.8.4
nbclassic==0.2.6
nbclient==0.5.3
nbconvert==6.0.7
nbformat==5.1.2
nest-asyncio==1.5.1
notebook==6.2.0
oauthlib @ file:///tmp/wheelhouse/oauthlib-3.1.0-py2.py3-none-any.whl
packaging==20.9
pamela @ file:///tmp/wheelhouse/pamela-1.0.0-py2.py3-none-any.whl
pandocfilters==1.4.3
parso==0.8.1
pexpect==4.8.0
pickleshare==0.7.5
prometheus-client @ file:///tmp/wheelhouse/prometheus_client-0.9.0-py2.py3-none-any.whl
prompt-toolkit==3.0.17
ptyprocess==0.7.0
pycparser @ file:///tmp/wheelhouse/pycparser-2.20-py2.py3-none-any.whl
pycurl==7.43.0.2
Pygments==2.8.1
pyOpenSSL @ file:///tmp/wheelhouse/pyOpenSSL-20.0.0-py2.py3-none-any.whl
pyparsing==2.4.7
pyrsistent @ file:///tmp/wheelhouse/pyrsistent-0.17.3-cp38-cp38-linux_x86_64.whl
python-dateutil @ file:///tmp/wheelhouse/python_dateutil-2.8.1-py2.py3-none-any.whl
python-editor @ file:///tmp/wheelhouse/python_editor-1.0.4-py3-none-any.whl
python-json-logger @ file:///tmp/wheelhouse/python_json_logger-2.0.1-py34-none-any.whl
pytz==2021.1
pyzmq==22.0.3
qtconsole==5.0.3
QtPy==1.9.0
requests @ file:///tmp/wheelhouse/requests-2.25.0-py2.py3-none-any.whl
ruamel.yaml @ file:///tmp/wheelhouse/ruamel.yaml-0.16.12-py2.py3-none-any.whl
ruamel.yaml.clib @ file:///tmp/wheelhouse/ruamel.yaml.clib-0.2.2-cp38-cp38-manylinux1_x86_64.whl
Send2Trash==1.5.0
six @ file:///tmp/wheelhouse/six-1.15.0-py2.py3-none-any.whl
sniffio==1.2.0
SQLAlchemy @ file:///tmp/wheelhouse/SQLAlchemy-1.3.20-cp38-cp38-manylinux2010_x86_64.whl
terminado==0.9.3
testpath==0.4.4
tornado==6.1
traitlets @ file:///tmp/wheelhouse/traitlets-5.0.5-py3-none-any.whl
urllib3 @ file:///tmp/wheelhouse/urllib3-1.26.2-py2.py3-none-any.whl
wcwidth==0.2.5
webencodings==0.5.1
widgetsnbextension==3.5.1
  • Configuration
# jupyterhub_config.py

c.Authenticator.admin_users = {'dev'}
c.JupyterHub.admin_access = True
c.Authenticator.delete_invalid_users = True
c.JupyterHub.ip = '0.0.0.0'
c.JupyterHub.port = 8900

origin = '*'
c.JupyterHub.tornado_settings = {
    'headers': {
      'Access-Control-Allow-Origin': origin,
   },
}
c.Spawner.args = ['--NotebookApp.allow_origin=*']
  • Logs
# [I 2021-03-22 10:56:11.735 SingleUserNotebookApp handlers:164] Saving file at /Untitled.ipynb
[I 2021-03-22 10:56:11.748 SingleUserNotebookApp log:181] 200 PUT /user/dev/api/contents/Untitled.ipynb (dev@172.17.0.1) 13.25ms
10:56:54.704 [ConfigProxy] error: 503 GET /user/dev/api/kernels/b2f3695b-bc19-4fcb-959c-26c7d09fd367/channels?session_id=304d2084af0f4c3681ee4cfbbb8e74a9 socket hang up
[I 2021-03-22 10:56:54.706 JupyterHub log:181] 200 GET /hub/error/503?url=%2Fuser%2Fdev%2Fapi%2Fkernels%2Fb2f3695b-bc19-4fcb-959c-26c7d09fd367%2Fchannels%3Fsession_id%3D304d2084af0f4c3681ee4cfbbb8e74a9 (@127.0.0.1) 1.19ms
[I 2021-03-22 10:56:59.725 JupyterHub log:181] 200 GET /hub/api/authorizations/token/[secret] (dev@127.0.0.1) 14.67ms
[W 2021-03-22 10:56:59.726 SingleUserNotebookApp handlers:366] Replacing stale connection: b2f3695b-bc19-4fcb-959c-26c7d09fd367:304d2084af0f4c3681ee4cfbbb8e74a9
10:57:59.709 [ConfigProxy] error: 503 GET /user/dev/api/kernels/b2f3695b-bc19-4fcb-959c-26c7d09fd367/channels?session_id=304d2084af0f4c3681ee4cfbbb8e74a9 socket hang up
[I 2021-03-22 10:57:59.711 JupyterHub log:181] 200 GET /hub/error/503?url=%2Fuser%2Fdev%2Fapi%2Fkernels%2Fb2f3695b-bc19-4fcb-959c-26c7d09fd367%2Fchannels%3Fsession_id%3D304d2084af0f4c3681ee4cfbbb8e74a9 (@127.0.0.1) 1.21ms
[W 2021-03-22 10:58:08.688 SingleUserNotebookApp handlers:366] Replacing stale connection: b2f3695b-bc19-4fcb-959c-26c7d09fd367:304d2084af0f4c3681ee4cfbbb8e74a9
10:59:08.737 [ConfigProxy] error: 503 GET /user/dev/api/kernels/b2f3695b-bc19-4fcb-959c-26c7d09fd367/channels?session_id=304d2084af0f4c3681ee4cfbbb8e74a9 socket hang up


You say you are trying to run ‘in the cloud’. Can you provide more details on your deployment? On what service? Are there any cloud load-balancers or proxies or something like that?

The errors are on websocket endpoints, which suggests that there is a proxy layer between jupyterhub’s configurable-http-proxy and your browser somewhere that isn’t handling websocket requests correctly.

Are you using an nginx container to proxy to the jupyterhub container? Check the proxy setup info: Using a reverse proxy — JupyterHub 1.3.0 documentation

So i am running on nginx in a amazon cloud server. Can you help me with configuring the http-proxy. I am not sure how it works.

Yes i am and i am not able to understand the proxy setup, I have it addressing to 0.0.0.0:8900, as you can see my configuration file. And its been set to the domain name. I am sorry i am unaware of how it works. can you help with configuring it, because i can see the nginx/sites.enabled folder but i don’t know what exactly to put in there.

configurable-http-proxy is unlikely to be the issue. You should be able to leave that alone. What you need to do is make sure your nginx reverse proxy supports websockets. This is covered in the link @markperri shared, but the key part is this:

# top-level http config for websocket headers
# If Upgrade is defined, Connection = upgrade
# If Upgrade is empty, Connection = close
map $http_upgrade $connection_upgrade {
    default upgrade;
    ''      close;
}

...
        # websocket headers
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        proxy_set_header X-Scheme $scheme;

So i just create the file as you mentioned and put it in the site.enabled folder? Would that work? or do i have to do some modifications to it? I am asking because i have no clue about nginx or proxy, or how it handles etc.

Yes, you could put an nginx configuration file in sites.enabled, or edit the root nginx.conf, depending on how nginx is set up.

How have you set up nginx already to point to jupyterhub? Wherever that configuration already is is what you need to modify. I’d recommend using exactly the nginx configuration in the jupyterhub docs, only changing the target ip address and the paths to your SSL certificates.

I’m not sure if it matters, but I put the nginx config into /etc/nginx/conf.d/jupyterhub.conf
Make sure you delete the /etc/nginx/conf.d/default.conf as it sets up a default server that you probably don’t want.