jupyter_server icon indicating copy to clipboard operation
jupyter_server copied to clipboard

Shutting down the server started with password pre-set will encounter an error `tornado.httpclient.HTTPClientError: HTTP 403: Forbidden`

Open HongW2019 opened this issue 3 years ago • 3 comments

Description

When I install jupyter_server above 1.16.0, running jupyter lab stop to shut down server started with password pre-set will encounter an error tornado.httpclient.HTTPClientError: HTTP 403: Forbidden

# jupyter lab stop
Shutting down server on 8888...
Traceback (most recent call last):
  File "/root/miniconda2/envs/master/bin/jupyter-lab", line 8, in <module>
    sys.exit(main())
  File "/root/miniconda2/envs/master/lib/python3.7/site-packages/jupyter_server/extension/application.py", line 594, in launch_instance
    serverapp.start()
  File "/root/miniconda2/envs/master/lib/python3.7/site-packages/jupyter_server/serverapp.py", line 2814, in start
    self.start_app()
  File "/root/miniconda2/envs/master/lib/python3.7/site-packages/jupyter_server/serverapp.py", line 2710, in start_app
    super().start()
  File "/root/miniconda2/envs/master/lib/python3.7/site-packages/jupyter_core/application.py", line 258, in start
    self.subapp.start()
  File "/root/miniconda2/envs/master/lib/python3.7/site-packages/jupyter_server/serverapp.py", line 608, in start
    self._shutdown_or_exit(port, server)
  File "/root/miniconda2/envs/master/lib/python3.7/site-packages/jupyter_server/serverapp.py", line 583, in _shutdown_or_exit
    if not self.shutdown_server(server):
  File "/root/miniconda2/envs/master/lib/python3.7/site-packages/jupyter_server/serverapp.py", line 579, in shutdown_server
    return shutdown_server(server, log=self.log)
  File "/root/miniconda2/envs/master/lib/python3.7/site-packages/jupyter_server/serverapp.py", line 516, in shutdown_server
    raise ex
  File "/root/miniconda2/envs/master/lib/python3.7/site-packages/jupyter_server/serverapp.py", line 512, in shutdown_server
    headers={"Authorization": "token " + server_info["token"]},
  File "/root/miniconda2/envs/master/lib/python3.7/site-packages/jupyter_server/utils.py", line 352, in fetch
    response = HTTPClient(AsyncHTTPClient).fetch(request)
  File "/root/miniconda2/envs/master/lib/python3.7/site-packages/tornado/httpclient.py", line 135, in fetch
    functools.partial(self._async_client.fetch, request, **kwargs)
  File "/root/miniconda2/envs/master/lib/python3.7/site-packages/tornado/ioloop.py", line 529, in run_sync
    return future_cell[0].result()
tornado.httpclient.HTTPClientError: HTTP 403: Forbidden

Same to #4386

Reproduce

pip install jupyter_server==1.19.1 jupyterlab
jupyter lab password 
nohup jupyter lab --no-browser  > /tmp/jupyterlab.log 2>&1 &
jupyter lab stop

Expected behavior

jupyter lab stop can shut down server with password pre-set scenario.

Context

  • Operating System and version:
  • Browser and version:
  • Jupyter Server version: above 1.16.0
Troubleshoot Output
Paste the output from running `jupyter troubleshoot` from the command line here.
You may want to sanitize the paths in the output.
Command Line Output
Paste the output from your command line running `jupyter lab` here, use `--debug` if possible.
Browser Output
Paste the output from your browser Javascript console here, if applicable.

HongW2019 avatar Sep 30 '22 08:09 HongW2019

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

welcome[bot] avatar Sep 30 '22 08:09 welcome[bot]

I'm running into the same issue. Are there any alternative ways to stop Jupyter Server instances that are running in the background?

maawoo avatar Apr 24 '23 14:04 maawoo

I could not reproduce the problem Env : Python 3.8 OS : Debian GNU/Linux 11 (bullseye) @HongW2019 / @maawoo are you still experiencing this problem

allstrive avatar Apr 19 '24 02:04 allstrive