Skip to content

Notebook doesn't stop cleanly #4386

@spencermathews

Description

@spencermathews

jupyter notebook stop is failing, leaving the server running and forcing it to be manually killed. I observe the following output:

$ jupyter notebook stop
Shutting down server on port 8888 ...
[W 16:27:53.830 NotebookApp] 403 POST /api/shutdown (127.0.0.1): '_xsrf' argument missing from POST
[W 16:27:53.858 NotebookApp] 403 POST /api/shutdown (127.0.0.1) 28.38ms referer=None
Traceback (most recent call last):
  File "/home/xxxx/anaconda3/bin/jupyter-notebook", line 11, in <module>
    sys.exit(main())
  File "/home/xxxx/anaconda3/lib/python3.7/site-packages/jupyter_core/application.py", line 266, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/home/xxxx/anaconda3/lib/python3.7/site-packages/traitlets/config/application.py", line 658, in launch_instance
    app.start()
  File "/home/xxxx/anaconda3/lib/python3.7/site-packages/notebook/notebookapp.py", line 1758, in start
    super(NotebookApp, self).start()
  File "/home/xxxx/anaconda3/lib/python3.7/site-packages/jupyter_core/application.py", line 255, in start
    self.subapp.start()
  File "/home/xxxx/anaconda3/lib/python3.7/site-packages/notebook/notebookapp.py", line 456, in start
    if not self.shutdown_server(server):
  File "/home/xxxx/anaconda3/lib/python3.7/site-packages/notebook/notebookapp.py", line 447, in shutdown_server
    return shutdown_server(server, log=self.log)
  File "/home/xxxx/anaconda3/lib/python3.7/site-packages/notebook/notebookapp.py", line 407, in shutdown_server
    HTTPClient().fetch(req)
  File "/home/xxxx/anaconda3/lib/python3.7/site-packages/tornado/httpclient.py", line 119, in fetch
    self._async_client.fetch, request, **kwargs))
  File "/home/xxxx/anaconda3/lib/python3.7/site-packages/tornado/ioloop.py", line 576, in run_sync
    return future_cell[0].result()
tornado.httpclient.HTTPClientError: HTTP 403: Forbidden

The only modifications I've made to jupyter_notebook_config.py are:

c.NotebookApp.ip = '127.0.0.1'      # 'localhost' errors with "OSError: [Errno 99] Cannot assign requested address".
c.NotebookApp.open_browser = False  # I'm connecting via ssh port forwarding.

My jupyter_notebook_config.json contains a NotebookApp: password that was set up when first connecting (via JupyterLab).

I'm in the base environment of a conda install on Linux.

This configuration used to work fine, i.e. jupyter notebook stop shut down the server without error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions