jupyterhub / jupyter-rsession-proxy

Jupyter extensions for running an RStudio rsession proxy
BSD 3-Clause "New" or "Revised" License
118 stars 87 forks source link

Kill rsessions when single-user notebook server stops #16

Closed iagomez closed 5 years ago

iagomez commented 6 years ago

Hello,

Is there a way to cleanup rsessions when the single-user servers stop running?

It seems like unless I explicitly quit the R session through R Studio, they are left untouched which could result in a large number of orphan sessions.

Let me know if I'm just doing something wrong.

Thanks!

ryanlovett commented 6 years ago

You're not doing anything wrong, but I'm afraid there is no good way of doing this IMO unless one integrates real process management into the extension (e.g. via cgroups, systemd, or some such). Ultimately I think the functionality of this extension will be obviated by having the JupyterHub spawner launch the rsession directly rather than through the Jupyter notebook. Since that already keeps track of the state of running servers it wouldn't be necessary to have something else keep track.

I think that will all be practical when the support for multiple servers per user lands which is either very soon or already done. :)

yuvipanda commented 6 years ago

We should be able to do this by registering for a python handler for 'atexit' (https://docs.python.org/3/library/atexit.html) and killing the subprocess when we receive this.

yuvipanda commented 5 years ago

This is accomplished now with https://github.com/jupyterhub/nbserverproxy/pull/64