Shiny Timeout / 502 Proxy Error

790 views
Skip to first unread message

Juha Kekäläinen

unread,
Oct 14, 2014, 6:15:00 AM10/14/14
to shiny-...@googlegroups.com
Hello,

I am having problems with Apache proxypass and Shiny-server. Proxypass works just fine until I try to download some plots from my application. Depending of the input-data it could take up to 5 minutes to generate plots but after 45 seconds I'll get "502 Proxy Error" with browsers but on the server R-process is still processing input data. And apache error_log contains following line:

[Tue Oct 14 12:28:28.790744 2014] [proxy:error] [pid 15200] [client 10.0.0.1:62766] AH00898: Error reading from remote server returned by /shiny_app/session/80bfd4aa9219ab7f4886a532042332a7/download/downloadPlots, referer: http://servername.local/shiny_app/

Strange thing is that with Shiny Server v0.3.6 timeout is 2 minutes and with the 1.2.3.0 release it is only 45 seconds. How do I control this timeout? I am quite sure that it is shiny-server which throws me those proxy errors as Nginx did the same thing with same timeouts (2 minutes and 45 seconds)

I have tried all kind of tricks with Apache. Different proxy-timeouts and forcing proxy-requests etc etc but no effect on timeout. I have found only one way to change timeout from 45 second to 2 minutes is to go back to v0.3.6 which is not a solution. 

So, any ideas how to control this timeout?

I tried app_init_timeout and app_idle_timeout, but change. No matter what value I set timeout sticks on 45 seconds :S

Without the proxy Shiny-server works and i'll get no timeouts

-- Juha 

Shiny 0.3.6 config:
cat /etc/shiny-server/shiny-server.conf
run_as shiny;
server {

        listen 3838;

        location / {
                site_dir /srv/shiny-server;
                log_dir /var/log/shiny-server;
                directory_index on;
        }
}

Shiny 1.2.3.0 config:
cat /etc/shiny-server/shiny-server.conf
run_as shiny;
disable_websockets true;

server {
  listen 3838;

  location / {
    site_dir /srv/shiny-server/;
    log_dir /var/log/shiny-server/;
    directory_index on;
  }
}

Apache Config:
ProxyTimeout 1800
Timeout 1800

SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1

<VirtualHost *:80>
        
        proxyPass /shiny_app http://localhost:3838 retry=1 timeout=1800 Keepalive=On
        proxyPassReverse /shiny_app http://localhost:3838 retry=1 timeout=1800 Keepalive=On

        <Directory /var/www/html/>
                AllowOverride All
        </Directory>
        DocumentRoot /var/www/html/
        ServerName servername.local
</VirtualHost>

Juha Kekäläinen

unread,
Oct 15, 2014, 6:36:48 AM10/15/14
to shiny-...@googlegroups.com
Found solution!

After intensive Apache Documentation reading I found KeepAliveTimeout Directive and it seems to control this! At least now timeout is over 4 minutes which should be enough :)

Reply all
Reply to author
Forward
0 new messages