7

I'm running a R shiny application on an open source shiny-server, using Ubuntu and NGINX. However, my app keeps getting the message "Disconnected from the Server" for some reason and I can't seem to get it to work. The shiny app runs perfectly fine on my local.

I've tried the javascript workaround via the following suggestion in Shiny server session time out doesn't work, but it still doesn't seem to work.

Also tried to set app_idle_timeout and app_init_timeout to a longer duration, but to no avail.

This is my nginx config file:

server {
    listen 80;
    listen [::]:80;
    listen 443 ssl;

    server_name some_ip_address;

    location / {
         proxy_pass http://localhost:3838/;
         proxy_redirect http://localhost:3838/ $scheme://$host/;
         proxy_http_version 1.1;
         proxy_set_header Upgrade $http_upgrade;
         proxy_set_header Connection $connection_upgrade;
         proxy_read_timeout 20d;
    }

}

Was wondering if I editing shiny server or nginx config file to make this work? But I understand that it is only possible to extend the timeout in the pro version but I'm guessing there must be some workaround possible.

7
  • This error is most likely caused by an error inside the shinyapp, check the shiny logs or go onto your server and just use runApp to see of you can reproduce it
    – Pork Chop
    Jan 29, 2019 at 9:01
  • 1
    @PorkChop Thanks for the suggestion! I've changed the shiny logs and realized that there was a small error within my code which led to this problem. Managed to fix it now
    – ZPeh
    Jan 29, 2019 at 14:18
  • Glad it worked out, I see the disconnects all the time with shiny-server make sure and use try catch and req where appropriate
    – Pork Chop
    Jan 29, 2019 at 14:20
  • That looks like an nginx config. Is that really your Shiny Server config, or an nginx config file named shiny-server.conf?
    – greg L
    Jan 29, 2019 at 15:33
  • @PorkChop Yes, the disconnect with shiny-server is quite annoying, will heed your advice and thank you once again!
    – ZPeh
    Jan 31, 2019 at 3:04

1 Answer 1

7

You can disable application idle timeouts in Shiny Server (open source or Pro) by setting app_idle_timeout to 0 in your Shiny Server config file.

For example,

location / {
    app_idle_timeout 0;
}

https://docs.rstudio.com/shiny-server/#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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.