JupyterHub failing to connect to kernel

Hi there.

I’m trying to use the Python3 kernel in JupyterHub.
I created a notebook and entered print("test") in the first cell.
When I run this cell, nothing happens; I just get an In[*] and no execution.

Here is the error message that was displayed.

Connection failed
A connection to the notebook server could not be established.
The notebook will continue trying to reconnect.
Check your network connection or notebook server configuration.

The console of the browser (Chrome) showed the following error message.

WebSocket connection to ‘ws://’ failed:

  • Environment
    • Ubuntu 18.04 LTS
# python3 --version
Python 3.6.9

# jupyterhub --version

# jupyter --version
jupyter core : 4.7.1
jupyter-notebook : 6.4.3
qtconsole : 5.1.1
ipython : 7.16.1
ipykernel : 5.5.5
jupyter client : 6.2.0
jupyter lab : 3.1.11
nbconvert : 6.0.7
ipywidgets : 7.6.4
nbformat : 5.1.3
traitlets : 4.3.3

I believe that the versions of tornado and prompt-toolkit that appear in the countermeasure are fine when I check past error information.

# pip3 freeze | grep tornado
# pip3 freeze | grep prompt-toolkit

Could you think of any other possible causes?

One cause of this is if you’ve got something that can’t handle websockets in your network path, e.g. a proxy.

Can you give us full details on how you setup and configured JupyterHub?

Thank you for your confirmation.
There is no Proxy in the network path, but I have checked if there is anything else that cannot handle WebSocket.

The JupyterHub server is built on AWS EC2.
The client where the error occurred is also on EC2 and is accessed from a different VPC than the JupyterHub server via VPC peering.
I built JupyterHub in October, and it was working fine at that time.
After that, I did not use it for about a month, so I stopped EC2. Recently, when I started EC2 and accessed JupyterHub, I got an error and it is still continuing.

JupyterHub was installed using pip according to GitHub’s Installation.

I used “ldapauthenticator” for authentication, but since I can login to JupyterHub, I think it is not related to this error.

The configuration of JupyterHub is as follows.

c.JupyterHub.extra_log_file = '/var/log/jupyterhub.log'
c.Spawner.default_url = '/lab'
c.JupyterHub.authenticator_class = 'ldapauthenticator.LDAPAuthenticator'
c.LDAPAuthenticator.server_address = 'xxx.xxx.xxx.xxx'
c.LDAPAuthenticator.lookup_dn = True
c.LDAPAuthenticator.use_lookup_dn_username = False
c.LDAPAuthenticator.lookup_dn_search_filter = '({login_attr}={login})'
c.LDAPAuthenticator.lookup_dn_search_user = 'xxxxxxxx'
c.LDAPAuthenticator.lookup_dn_search_password = 'xxxxxxxx'
c.LDAPAuthenticator.user_search_base = 'dc=xxxxxxxx,dc=xxxxxxxx'
c.LDAPAuthenticator.user_attribute = 'sAMAccountName'
c.LDAPAuthenticator.lookup_dn_user_dn_attribute = 'cn'
c.LDAPAuthenticator.escape_userdn = False
c.LDAPAuthenticator.valid_username_regex = '^[a-zA-Z0-9][.a-zA-Z0-9_-]*$'
c.LDAPAuthenticator.use_ssl = False

If JupyterHub was previously working and nothing has changed in JupyterHub then it’ll most likely be a change to the networking somewhere, or perhaps something changed on the client (e.g. perhaps a change to the browser, or anti-virus software getting in the way?)

1 Like

Thank you for your confirmation.
I have since been able to isolate the problem as occurring only with some clients.
I believe that there is no problem with JupyterHub or the network, as some clients are available on the same network.
I am still investigating the client side of the problem.
Thank you very much for your help.

This issue has been resolved.
The cause was that the client’s Proxy settings had been changed without my knowledge.
I’m sorry for the trouble.