hydrogen icon indicating copy to clipboard operation
hydrogen copied to clipboard

token not working in jupyter kernelgateway

Open jsyoo61 opened this issue 2 years ago • 11 comments

Description

I have put my remote kernelgateway configurations in the setting like the following:

{"name": "my_server", "options": {"baseUrl": "http://ip:port", "token": "my_token"}}

but whenever I try to connect to a server which does not have any running kernels, it prompts me with a token authentication. When I try to connect to a server with a running python kernel, it won't prompt me for a token authentiation.

I was doing fine with Hydrogen when this started to happen around few months ago, so I think it's a bug somewhere around either Hydrogen or Jupyter Kernelgateway.

Steps to Reproduce

  1. Setup remote kernelgateway using jupyter [email protected]
  2. Setup configurations in hydrogen including "baseUrl" and "token"
  3. Hydrogen:connect-to-remote-kernel
  4. Select remote server from dropdown, which does not have a running python kernel
  5. hydrogen (or jupyter kernelgateway) prompts for token authentication

Versions

OS version: Windows 10.0.19042.1165

atom --version

Atom    : 1.58.0
Electron: 9.4.4
Chrome  : 83.0.4103.122
Node    : 12.14.1

apm --version

apm  2.6.2
npm  6.14.13
node 12.14.1 x64
atom 1.58.0
python 3.8.8
git 2.33.0.windows.1
visual studio

Hydrogen version:

[Your Hydrogen's version]

Hydrogen
├── 2.16.3
├── https://github.com/nteract/hydrogen
├── Run code interactively, inspect data, and plot. All the power of Jupyter kernels, inside your favorite text editor.
├── 2423086 downloads
└── 802 stars

[Jupyter kernelgateway version]

jupyter [email protected]

Plugins

Have you installed and activated any of the Hydrogen plugins below ?

  • Hydrogen Launcher
  • hydrogen-python
  • Data Explorer

None.

Logs

no logs in console

Expected behavior

Connect to remote kernelgateways without prompting for token.

Screenshots

Setting: setting

When there's no running sessions in server: no session

When there's running sessions in server: existing session

Additional context

This started happening few months ago. Until then, the "token" from hydrogen setting was working fine.

jsyoo61 avatar Sep 27 '21 00:09 jsyoo61

I second this (to some extent). Connecting to my remote kernel also prompts me to input the token manually, even if it is already given in the kernelgateway configurations in Hydrogen's properties. This was not requested in previous versions. (atom 1.57.0, hydrogen 2.16.3, ubuntu 20.04.)

LRydin avatar Sep 27 '21 10:09 LRydin

Same here and unable to connect to remote kernels (python, R, bash, julia) with a valid configuration in Kernel Gateways and otherwise working jupyter kernels in the remote jupyter lab environment. This used to work without any issues several weeks before. Also, I removed token parameter and hydrogen failed to prompt me for a token. Hydrogen and Remote jupyter configurations seem ok per #2109.

I also tried using atom and hydrogen env in linuxbox (RHEL 7) as well as reverting Hydrogen to previous versions of Hyrdrogen, 2.16.2 and 2.15.3 but no luck.

Please help debugging this.

Thanks!

[{ "name": "remote1", "options": { "baseUrl": "https://node1.example.com:10000", "token": "blahblahblahblahblahblah"} }, { "name": "remote2", "options": { "baseUrl": "https://node2.example.com:10000", "token": "blahblahblahblahblahblah"} }]

SysInfo

Mac OS 10.15.7 (Intel) Atom 1.55.0 x64 Hydrogen 2.16.3

Remote jupyter server

jupyter core     : 4.5.0
jupyter-notebook : 6.0.1
qtconsole        : 4.5.5
ipython          : 7.8.0
ipykernel        : 5.1.2
jupyter client   : 5.3.3
jupyter lab      : 1.1.4
nbconvert        : 5.6.0
ipywidgets       : 7.5.1
nbformat         : 4.4.0
traitlets        : 4.3.3

remote server config at ~/.jupyter/jupyter_notebook_config.py

#### NOTEBOOK CONFIGS ####
c.NotebookApp.certfile = u'path_to_cert.pem'
c.NotebookApp.keyfile = u'path_to_ssl.key'
c.JupyterHub.cookie_secret_file = '/home/foo/.configs/jupyterhub_cookie'
c.JupyterHub.proxy_auth_token = 'ABCDabcd1234ABCDabcd1234ABCDabcd1234'
c.NotebookApp.token = 'blahblahblahblahblahblah'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 10000

c.Application.log_level = 'INFO'
## should be set to False - unsafe to set True from https security point of view
## https://github.com/nteract/hydrogen/issues/2109
c.NotebookApp.disable_check_xsrf = False

c.NotebookApp.port_retries = 0

c.NotebookApp.terminado_settings={'shell_command':['bash', '-l']}

## This option was enabled earlier but now, hydrogen does not connect to
## remote kernel whether or not this option is enabled or not.
#c.NotebookApp.ssl_options = {
#  'ssl_version': 5
#}

logs from remote jupyter server:

[I 17:21:51.745 NotebookApp] Kernel started: fdfcc...
[I 17:22:01.409 NotebookApp] Adapting from protocol version 5.0 (kernel fdfcc...) to 5.3 (client).
[I 17:22:01.430 NotebookApp] Adapting from protocol version 5.0 (kernel fdfcc...) to 5.3 (client).
[I 17:29:12.565 NotebookApp] Kernel restarted: fdfcc...

logs from Atom dev console:

[Violation] Added non-passive event listener to a scroll-blocking 'mousewheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952

Kernel: reconnecting (fdfcc...)
Connection lost, reconnecting in 1 seconds.
Starting WebSocket: wss:...
Connection lost, reconnecting in 2 seconds.
Starting WebSocket: wss:...
Connection lost, reconnecting in 4 seconds.
Starting WebSocket: wss:...
Connection lost, reconnecting in n seconds.
Starting WebSocket: wss:...

sbamin avatar Oct 20 '21 22:10 sbamin

Pinging @aminya - Please look into this issue if possible. Without this, I am unable to use remote running kernel using Atom editor and making routine work quite difficult. Thanks!

sbamin avatar Oct 28 '21 17:10 sbamin

I will look into this over the next week. You can downgrade Hydrogen temporarily if you want

aminya avatar Oct 30 '21 00:10 aminya

Hi @aminya , I tried also using 2.16.2 and 2.15.3 and also on my linux machine but no luck. I am now trying to reset my conda env on remote machine and see if issue is related to remote and not host env. Much appreciated if you can check on your end if issue is something to do with hydrogen.

sbamin avatar Nov 16 '21 15:11 sbamin

Looks like I can not make this work by nearly all possible workarounds, including resetting my remote linux environment from scratch and doing the same on macbook. Seems like issue is more to do with hydrogen package and I can't find a way to solve this issue. Hope someone can find a stable fix.

sbamin avatar Dec 02 '21 23:12 sbamin

Update: I did some more debugging - If I disable SSL when starting jupyter notebook, hydrogen (current or older versions) can now connect to remote jupyter session but fails if I keep SSL active. Default config c.NotebookApp.allow_remote_access = False has no impact and changing it to True does not fix connection issue (with SSL on). I do not prefer to disable SSL though!

sbamin avatar Dec 03 '21 16:12 sbamin

Any update that we should expect on this issue? I ended up resetting twice in vain to make hydrogen remote kernel work. @aminya

sbamin avatar Jan 06 '22 22:01 sbamin

Is this issue fixed???

myvitriol avatar Apr 17 '22 02:04 myvitriol

@myvitriol I faced this issue in the past, but for ~2 months now it seems to be gone, at least for me. Are you still facing a problem here?

LRydin avatar Apr 20 '22 10:04 LRydin

Issue has become stale and issue persists: kernel gateway works only using http but not using https mode. VS code is a good alternative.

sbamin avatar Apr 20 '22 15:04 sbamin