nteract / hydrogen

:atom: Run code interactively, inspect data, and plot. All the power of Jupyter kernels, inside your favorite text editor.
https://nteract.gitbooks.io/hydrogen/
MIT License
3.92k stars 334 forks source link

token not working in jupyter kernelgateway #2132

Open jsyoo61 opened 3 years ago

jsyoo61 commented 3 years ago

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 kernelgateway@2.5.0
  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 kernelgateway@2.5.0

Plugins

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

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.

LRydin commented 3 years ago

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.)

sbamin commented 3 years ago

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 commented 3 years ago

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!

aminya commented 3 years ago

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

sbamin commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

myvitriol commented 2 years ago

Is this issue fixed???

LRydin commented 2 years ago

@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?

sbamin commented 2 years ago

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