Skip to content

Jupyter Notebok server process stays up after "shut down" due to shutdown_no_activity_timeout #5386

@bensussman

Description

@bensussman

The jupyter process is staying up and not exiting even though it has "shut down" from shutdown_no_activity_timeout and is no longer listening on the configured port.

When configuring our Jupyter notebook (also run via Docker) we pass the following arguments:

jupyter notebook \
 --ip 0.0.0.0 \
 --allow-root \
 --no-browser \
 --log-level=DEBUG \
 --NotebookApp.allow_password_change=False \
 --NotebookApp.quit_button=False \
 --NotebookApp.shutdown_no_activity_timeout=60 \
 --MappingKernelManager.cull_idle_timeout=60 \
 --MappingKernelManager.cull_interval=10 \
 --MappingKernelManager.cull_connected=True \
 --MappingKernelManager.cull_busy=False

And the behavior we are seeing is that:

  • It is correctly culling idle kernels after 60s
  • It is (usually) correctly shutting down the server after there are no kernels and the no activity timeout has exceeded
  • When the server is shutdown, the PROCESS DOES NOT EXIT so the docker container just hangs waiting for the process to exit
  • Looking at netstat shows that our configured port 8888 was being LISTENED to before shutdown and is no longer being listened to post shutdown, but the container remains up (and therefore the process has not yet exited).
  • When shutting down the server manually (not by the NotebookApp.shutdown_no_activity_timeout but by sending it a termination signal) it exits correctly.

One lead we have is that Websocket closed appears in the logs when shutting down the notebook manually, but does not appear when shut down due to shutdown_no_activity_timeout so our hypothesis is that there is a bug in the shutdown_no_activity_timeout code which is not correctly or fully shutting down the jupyter process.

This might be the same or similar issue as #5328 but unclear if that one is shutdown_no_activity_timeout related or if they are different. I didn't fully follow #4868 but it could also be related?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions