Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shiny apps not rendering after updated to v1.3.0 #2372

Closed
andresrcs opened this issue Apr 8, 2019 · 18 comments
Closed

Shiny apps not rendering after updated to v1.3.0 #2372

andresrcs opened this issue Apr 8, 2019 · 18 comments
Labels
Type: Regression Functionality from a previous release no longer works

Comments

@andresrcs
Copy link

@andresrcs andresrcs commented Apr 8, 2019

All my apps have stopped rendering after I updated to shiny v 1.3.0 and I get not error messages in the logs, for example this app under v 1.3.0 renders like this

image

image

And after downgrading to v1.2.0 it renders normally, I get the same behaviour with all my apps.

image

My shiny-server version is 1.5.9.923 open source, running under ubuntu server 18.04.2 LTS

@wch
Copy link
Collaborator

@wch wch commented Apr 8, 2019

Can you put sessioninfo::session_info() in one of your apps and render the output in a verbatimTextOutput, then post the output here? (You'll also need to install the sessioninfo package.)

Also, if you could provide a minimal reproducible example, that would help.

@andresrcs
Copy link
Author

@andresrcs andresrcs commented Apr 8, 2019

Ok, here is the reprex with session_info()
app.R

library(shiny)

ui <- fluidPage(

    titlePanel("Reprex"),

    sidebarLayout(
        sidebarPanel(
        ),

        mainPanel(
            verbatimTextOutput("info")
        )
    )
)

server <- function(input, output) {

    output$info <- renderPrint({
        print(sessioninfo::session_info())
    })
}

shinyApp(ui = ui, server = server)

With Shiny v 1.3.0 renders nothing
image

With Shiny v 1.2.0 shows this
image

@jcheng5
Copy link
Member

@jcheng5 jcheng5 commented Apr 8, 2019

@andresrcs What do you see in your browser's JavaScript console when it fails to load?

@wch
Copy link
Collaborator

@wch wch commented Apr 8, 2019

FWIW, it seems to work OK when I run the same app in Ubuntu 18.04.2, with R-devel (this is running from R directly, not in Shiny Server):

image

@andresrcs
Copy link
Author

@andresrcs andresrcs commented Apr 8, 2019

BTW I get the same behaviour on a Debian Stretch (Raspbian Stretch) server, so I think this is not related to Ubuntu 18.

@andresrcs
Copy link
Author

@andresrcs andresrcs commented Apr 8, 2019

@andresrcs What do you see in your browser's JavaScript console when it fails to load?

@jcheng5
This is what I see

image
image

@jcheng5
Copy link
Member

@jcheng5 jcheng5 commented Apr 9, 2019

It almost looks like httpuv wasn't upgraded to 1.5.1...

@schloerke schloerke added the Type: Regression Functionality from a previous release no longer works label Apr 9, 2019
@wch
Copy link
Collaborator

@wch wch commented Apr 9, 2019

@andresrcs Does your code call addResourcePath() anywhere? We think this issue might be related to that.

@wch
Copy link
Collaborator

@wch wch commented Apr 9, 2019

@andresrcs It seems likely that this is a problem with your proxy configuration. Please see https://support.rstudio.com/hc/en-us/articles/213733868-Running-Shiny-Server-with-a-Proxy

@wch
Copy link
Collaborator

@wch wch commented Apr 9, 2019

This post on Community is about the same issue: https://community.rstudio.com/t/failed-to-load-resource/28142

@wch
Copy link
Collaborator

@wch wch commented Apr 9, 2019

For future reference, the user on community gave an example of his broken configuration, and then the working one:

Not working:

    location /apps/ {
      proxy_pass http://127.0.0.1:3838/apps/;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
    }

Working:

  map $http_upgrade $connection_upgrade {
      default upgrade;
      ''      close;
  }

[... stuff here ...]

    location /apps/ {
      proxy_pass http://127.0.0.1:3838/apps/;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection $connection_upgrade;
      proxy_read_timeout 20d;
      proxy_buffering off;
    }

@wch
Copy link
Collaborator

@wch wch commented Apr 9, 2019

We've merged a pull request in httpuv which makes it more lenient with proxies that are misconfigured this way. It can be installed with:

devtools::install_github('rstudio/httpuv')

@wch wch closed this as completed Apr 9, 2019
@andresrcs
Copy link
Author

@andresrcs andresrcs commented Apr 10, 2019

@wch
I have a problem implementing the correct proxy config solution, if I use this line in nginx config file proxy_set_header Connection $connection_upgrade; I get this error message and nginx won't start.

sudo service nginx restart
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.

systemctl status nginx.service
● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2019-04-10 01:34:09 UTC; 15s ago
     Docs: man:nginx(8)
  Process: 3985 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status
  Process: 3901 ExecReload=/usr/sbin/nginx -g daemon on; master_process on; -s reload (code=exited, status=0/SUCCESS)
  Process: 3876 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
  Process: 3986 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
 Main PID: 3881 (code=exited, status=0/SUCCESS)

abr 10 01:34:09 ip-172-xx-xx-xx systemd[1]: nginx.service: Failed with result 'timeout'.
abr 10 01:34:09 ip-172-xx-xx-xx systemd[1]: Stopped A high performance web server and a reverse proxy server.
abr 10 01:34:09 ip-172-xx-xx-xx systemd[1]: Starting A high performance web server and a reverse proxy server...
abr 10 01:34:09 ip-172-xx-xx-xx nginx[3986]: nginx: [emerg] unknown "connection_upgrade" variable
abr 10 01:34:09 ip-172-xx-xx-xx nginx[3986]: nginx: configuration file /etc/nginx/nginx.conf test failed
abr 10 01:34:09 ip-172-xx-xx-xx systemd[1]: nginx.service: Control process exited, code=exited status=1
abr 10 01:34:09 ip-172-xx-xx-xx systemd[1]: nginx.service: Failed with result 'exit-code'.
abr 10 01:34:09 ip-172-xx-xx-xx systemd[1]: Failed to start A high performance web server and a reverse proxy server.

What confuses me the most is this line:
abr 10 01:34:09 ip-172-xx-xx-xx nginx[3986]: nginx: [emerg] unknown "connection_upgrade" variable

If I use this instead proxy_set_header Connection "connection_upgrade"; it works, even with the CRAN version of httpuv (1.5.1)

What could be the problem? I get this behaviour on Ubuntu 18.04.2 LTS - nginx 1.14.0-0ubuntu1.2 and Debian Stretch - nginx 1.10.3-1+deb9u2

@jcheng5
Copy link
Member

@jcheng5 jcheng5 commented Apr 10, 2019

connection_upgrade is a variable that is declared using that "map $http_upgrade $connection_upgrade {...}" part. Make sure to include that map directive in your config.

@andresrcs
Copy link
Author

@andresrcs andresrcs commented Apr 10, 2019

Thanks, I have missed that part, I'm still confused about why this works proxy_set_header Connection "connection_upgrade"; with httpuv 1.5.1 and this doesn't proxy_set_header Connection "upgrade" but I suppose it doesn't matter.

@jcheng5
Copy link
Member

@jcheng5 jcheng5 commented Apr 10, 2019

Yeah, it's a bit confusing. httpuv specifically detects and rejects Connection: upgrade when serving up static files like JS and CSS files. But you should still not use Connection: connection_upgrade because it will keep proxy-to-httpuv connections open longer than necessary by implicitly enabling HTTP keepalive. We really do want Connection: close for non-WebSocket requests.

@andresrcs
Copy link
Author

@andresrcs andresrcs commented Apr 10, 2019

Thanks for the clarification, I have fixed the problem and everything is working fine now

@thiagoveloso
Copy link

@thiagoveloso thiagoveloso commented Apr 10, 2019

For future reference, the user on community gave an example of his broken configuration, and then the working one:

Not working:

    location /apps/ {
      proxy_pass http://127.0.0.1:3838/apps/;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
    }

Working:

  map $http_upgrade $connection_upgrade {
      default upgrade;
      ''      close;
  }

[... stuff here ...]

    location /apps/ {
      proxy_pass http://127.0.0.1:3838/apps/;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection $connection_upgrade;
      proxy_read_timeout 20d;
      proxy_buffering off;
    }

I also had issues with shiny v.1.3.0 not loading apps properly and I fixed them by adding the map block that you mention in your reply. Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Regression Functionality from a previous release no longer works
Projects
None yet
Development

No branches or pull requests

5 participants