yuvipanda / jupyterhub-ssh

SSH Access to JupyterHubs
BSD 3-Clause "New" or "Revised" License
93 stars 29 forks source link

Server connected to via SSH culled by inactivity - can we avoid it? #67

Open consideRatio opened 2 years ago

consideRatio commented 2 years ago

As initially reported in https://github.com/pangeo-data/jupyter-earth/issues/105, I think the jupyterhub-idle-culler fails to recognize that a user may be active via a SSH connection when using jupyterhub-ssh. Is this something we can avoid?

I'm not feeling confident about if we can, or how we would go about it. Very related reading is the jupyterhub-idle-culler's README's How it works section though.

As a workaround, I've suggested visiting the user server via a typical Jupyter UI, opening a notebook, and running something like import time; time.sleep(3600*24*7) to make a kernel stay running, which would block the culler logic.

yuvipanda commented 2 years ago

To avoid an server where we have an active ssh connection from being culled, I think the ssh server code here needs to send some 'ping' packets at regularly timed intervals. Should not be too difficult to do.

consideRatio commented 2 years ago

To avoid an server where we have an active ssh connection from being culled, I think the ssh server code here needs to send some 'ping' packets at regularly timed intervals.

Are you trying to stimulate activity as registered by the proxy server then? Hmmm... Is the networking something like:

A users local computer establishes a SSH connection (-> autohttps) -> jupyterhub-ssh server -> proxy pod / configurable-http-server via http -> user server via http

If that is the case, the proxy pod would receive http traffic, and that would make the server seen as active again I think. I'm asking to understand the mechanism of activity you hope to stimulate better.

consideRatio commented 2 years ago

There were some confusion that led to this issue being opened. I'm not sure if a jupyterhub-ssh based connection will or won't lead to inactivity.

I'm also unsure if SSH configuration (.ssh/ssh_config) on the user's local computer connecting to the jupyterhub-ssh server like below would help trigger an activity in the proxy pod.

TCPKeepAlive yes
ClientAliveInterval 30
ClientAliveCountMax 240

@yuvipanda do you think TCPKeepAlive or similar configuration, at some place, would activity to be ensured when connections are open?

Action points