Shinyproxy: Clarification about heartbeat for docker containers

Created on 25 Feb 2021  ·  4Comments  ·  Source: openanalytics/shinyproxy

As we're rolling out testing to users, I am starting to notice some containers that do not shut down as I would expect. I have reached out to a few of these users to see what behavior they have (i.e. are they leaving tabs open, etc.):

image

In the meantime, I was wondering if there are any timeout features configurable that I perhaps did not see in the documentation? It would be great to have a maximum age of container or something like that. We could write our own Docker control scripts that check on this, but it would be handy if there was something in ShinyProxy that allowed this, too.

question

Most helpful comment

BTW, we have some plans for a max-lifetime feature, that kills app after a certain amount of time, regardless whether it is in use. This isn't yet implemented and will probably not make it in the next release. I'll keep you informed if we start working on it.

All 4 comments

+1

Hi @jat255

ShinyProxy currently works as follows:

  • every proxy.heartbeat-rate ShinyProxy sends a hearbeat to the client. If the client answers, the internal state is updated with the current time. The default of heartbeat-rate is 10 seconds. These hearbeats are sent over the websocket channel (if any).
  • every HTTP request to an app also updates the internal state.
  • if the last hearbeat of a container is longer than proxy.heartbeat-timeout ago, ShinyProxy kills the app. This is by default 60 seconds.

As long as the user keeps their browser open and the websocket connection is open or HTTP requests are sent, ShinyProxy assumes that the app is in use and thus will not kill it.
Note that Spring will also keep the session of the user open as long as the app is sending HTTP requests.

Therefore it could happen that apps are living for a long time. However, I see that you have on app that is open for 75hours, which is about three days, this would mean that the user has their computer running for three days (without suspend). Could this be the case? If not, you may have found a bug, which we aren't aware of.

BTW, we have some plans for a max-lifetime feature, that kills app after a certain amount of time, regardless whether it is in use. This isn't yet implemented and will probably not make it in the next release. I'll keep you informed if we start working on it.

@LEDfan thanks so much for the clarification. I'm not certain if the long-running session is a bug, or if someone left a tab running on their office computer (trying to get more info from the user). This limited session lifetime is a security concern for our IT sec team (they don't like seeing something logged in for a long time without a user sitting there). Something like max-lifetime would indeed be useful. I think in the meantime, we're going to bake in a timeout function a la this idea, to present our users with a warning that they're about to be logged out, and then killing the Shiny server if there's no response, which (as I understand) should make the docker containers get cleaned out. I'll go ahead and close this based off the clarification above. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jat255 picture jat255  ·  6Comments

algo-se picture algo-se  ·  6Comments

benkates picture benkates  ·  3Comments

fmmattioni picture fmmattioni  ·  3Comments

thomas-chauvet picture thomas-chauvet  ·  5Comments