RStudio in Rserver, disable idle timeout on ShinyApp

3.1k views Asked by At

When running my ShinyApp locally, the webpage interactivity never shutdowns (turns grey and takes no user input). When running this same app in browser r-server RStudio, app shutdowns in a minute or so.

Any dummy server would do, but for example

library(shiny)
ui <- fluidPage(
  h1("Example"),
  inputPanel(
    actionButton("button", "This is button")
  )
  
)
server <- function(input, output){
  observeEvent(input$button,
                print("Button pressed.")
  )
}
shinyApp(ui=ui, server=server)

follows the described behavior.

How do I disable or bypass this?

1

There are 1 answers

1
mhovd On

This might depend on your server - do you experience the same issue when publishing to shinyapps? If not, it could be an issue with the RStudio server setup.

Either way, take a look at the configuration reference:

3.3 Application Timeouts

app_idle_timeout -- Defines the amount of time (in seconds) an R process with no active connections should remain open. After the last connection disconnects from an R process, this timer will start and, after the specified number of seconds, if no new connections have been created, the R process will be killed. The default value for app_idle_timeout is 5 seconds. Setting app_idle_timeout to 0 will disable the app idle time out.

EDIT: In case it is your RStudio server, take a look at /etc/rstudio/rsession.conf - especially session-timeout-minutes=nn (Reference).