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

RMarkdown presentation with Shiny is working fine locally but couldn't open on ShinyServer #144

Closed
Nicolabo opened this issue Aug 25, 2015 · 24 comments

Comments

@Nicolabo
Copy link

I have a problem with my simple RMarkdown document which use shiny widgets. I mean, it works fine locally but when I want to throw it into the ShinyServer it does not work at all. Actually it does not give any error.


title: "Test"
author: ""
date: "17.08.2015"
runtime: shiny

output: html_document

library(ggplot2)
data(mtcars)
selectInput('name', 'Choose a cylinder:',
            choices = sort(unique(mtcars$cyl)),
            selected = sort(unique(mtcars$cyl))[1])
data <- reactive(subset(mtcars,cyl == input$name))
number <- reactive(which(sort(unique(mtcars$cyl)) == input$name))
renderPlot(ggplot(data(),aes(qsec, mpg))+
  geom_point(size = 6))

I use ShinyServer v1.3.0 and work on Revolution R Open 3.2.1.

sessionInfo()
other attached packages:
[1] ggplot2_1.0.1 rmarkdown_0.7 shiny_0.12.1
[4] RevoUtilsMath_3.2.1

loaded via a namespace (and not attached):
[1] Rcpp_0.11.6 digest_0.6.8 MASS_7.3-40 mime_0.3
[5] grid_3.2.1 R6_2.0.1 plyr_1.8.3 xtable_1.7-4
[9] gtable_0.1.2 magrittr_1.5 scales_0.2.5 stringi_0.5-5
[13] reshape2_1.4.1 proto_0.3-10 tools_3.2.1 stringr_1.0.0
[17] munsell_0.4.2 httpuv_1.3.2 colorspace_1.2-6 htmltools_0.2.6.

@fereshtehRS
Copy link
Contributor

@Nicolabo I am using Shiny Server v1.3.0.403.
I used your RMarkdown code and ran it Shiny Server, and it works fine. I have to make a couple of changes in the code, but I think that is because the code has been rendered here, and I had to adjust for that. If you r code runs fine locally, you wouldn't need any changes.

Your issue might be caused by the way you have deployed it on Shiny Server. This code must be in a file of its own, let's call it test.Rmd, and in a directory of its own, let' call it rmarkdown-doc under your root of applications on Shiny Server. If your root of documents is /srv/shiny-server (the default), then you would have the following:

/srv/shiny-server/rmarkdown-doc/test.Rmd

And to access it you use: http://<hostname>:3838/rmarkdown-doc (assuming the default port of 3838.

Let us know if this helps, or if you continue having an issue.

@kjedrzejewski
Copy link

@fereshtehRS
I work with @Nicolabo. I've set everything exactly as you described:

[root@xxx test]# pwd
/srv/shiny-server/test
[root@xxx test]# ll
total 4
-rwxr-xr-x 1 root root 730 Aug 20 09:51 index.Rmd
[root@db-02 test]#

Also we're using the same version of Shiny as you mentioned:

[root@xxx test]# yum list installed | grep shiny
shiny-server.x86_64               1.3.0.403-1                        @/shiny-server-1.3.0.403-rh5-x86_64

Still, when I try load http://:3838/test/ it only shows loading animation and stops there.

@fereshtehRS
Copy link
Contributor

Just to be sure there is no rendering issue of the code, I am attaching an image of the RMarkdown that I am running. Can you verify you have similar code.

rmarkdown-doc

@Nicolabo
Copy link
Author

Nicolabo commented Sep 1, 2015

That's right. I checked it twice and the problem still exists.

I also looked at log but there is no reaction:

[root@xxx ~]# tail /var/log/shiny-server.log

[2015-09-01 17:02:28.814] [INFO] shiny-server - Shiny Server v1.3.0.403 (Node.js v0.10.21)
[2015-09-01 17:02:28.816] [INFO] shiny-server - Using pidfile /var/run/shiny-server.pid
[2015-09-01 17:02:28.818] [INFO] shiny-server - Using config file "/etc/shiny-server/shiny-server.conf"
[2015-09-01 17:02:28.852] [WARN] shiny-server - Running as root unnecessarily is a security risk! You could be running more securely as non-root.
[2015-09-01 17:02:28.855] [INFO] shiny-server - Starting listener on 0.0.0.0:3838
[root@xxx ~]#

@fereshtehRS
Copy link
Contributor

Do you see any errors in the browser console?
Can you send me your exact file? (email to fereshteh@rstudio.com)
Can you run R or RStudio IDE on the same machine as your Shiny Server, and run this document? There could be some permissions issue, or issue with third party libraries that is causing the problem, but not showing a good error.

@Nicolabo
Copy link
Author

Nicolabo commented Sep 1, 2015

No, nothing in the browser console.
I send you this file by e-mail.
We've istalled Shiny Server on our Centos 6.5 server. When I check this file in RStudioSever everything works fine. I mean, I get an warning related to RRO:

Multithreaded BLAS/LAPACK libraries detected. Using 1 cores for math algorithms.

@fereshtehRS
Copy link
Contributor

Your file works fine in my environment. I have to try it with Revolution R, in case there is an issue with that.

@Nicolabo
Copy link
Author

Nicolabo commented Sep 2, 2015

It will be great if you find a solution. Thanks!

@fereshtehRS
Copy link
Contributor

I should have asked this before, are you able top run any application on Shiny Server? What happens when you access the welcome page: http://hostname:3838? There is one RMarkdown application on that page. What do you see for that?

@kjedrzejewski
Copy link

It's same case as in case of our Rmarkdown document - only loading animation, which do not disappear.

If I remember correctly It was the same, when we were using vanilla R 3.0 on that server.

Is there any additional error log? Or any possibility to start logging additional information?

@Nicolabo
Copy link
Author

Nicolabo commented Sep 3, 2015

I think it also important to mention that previously we put shiny app in our server and everything worked fine.

@fereshtehRS
Copy link
Contributor

I have tried with Revo R as well, and no issues. I thought it might be permission issue, but cannot reproduce what you are seeing when limiting permissions.

There are application log file created in the /var/log/shiny-server directory. See if that file shows anything more.

And you said the plain Shiny applications run fine, right? It is only Shiny applications within RMarkdown that show the problem?

@kjedrzejewski
Copy link

As for content of /var/log/shiny-server directory, when I start loading http://[host]:3838/test/ a file appears there (named like: test-shiny-20150911-072905-49996.log ), and it's removed when the tab it was opened in is closed.
Before it is removed it contains something like:

Multithreaded BLAS/LAPACK libraries detected. Using 1 cores for math algorithms.

Listening on http://127.0.0.1:49996

There are some files which weren't removed. Each of them contains something like:

Multithreaded BLAS/LAPACK libraries detected. Using 1 cores for math algorithms.

Listening on http://127.0.0.1:57447


Error in strsplit(version_info, "\n")[[1]] : subscript out of bounds


Execution halted

or

Multithreaded BLAS/LAPACK libraries detected. Using 1 cores for math algorithms.

Listening on http://127.0.0.1:52582




Execution halted

No "not-removed" file was created today. Even when http://[host]:3838/test/ was left opened in a browser tab for over an hour.

I attach a screenshot of the http://[host]:3838 page:
screencapture-10-157-49-197-3838-1441970914419

@fereshtehRS
Copy link
Contributor

Don't know off hand what causes that error; it is likely that a version of one of your packages is causing that. I will ask around.

Can you install latest version of "rmarkdown" and see if that makes any difference?

@kjedrzejewski
Copy link

I've installed rmarkdown_0.8 from github. Nothing has changed.

@fereshtehRS
Copy link
Contributor

@trestletech mentioned that you might be having a wrong version of Pandoc, and running into this issue: rstudio/rmarkdown#109

Can you run the following commands on the server:

which pandoc

 /opt/shiny-server/ext/pandoc/pandoc --version

@kjedrzejewski
Copy link

[root@xxx ~]# which pandoc
/usr/bin/which: no pandoc in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)

The second one (/opt/shiny-server/ext/pandoc/pandoc --version) hangs.

@fereshtehRS
Copy link
Contributor

So it seems to be a Pandoc issue. My suggestion is for you to uninstall your current version of Shiny Server and install the latest available version. The version you have (403) should work, but seems like there might have been an issue during installation.

To uninstall:

sudo yum remove shiny-server

To download and install latest version please refer to this page:

https://www.rstudio.com/products/shiny/download-server/

See if there is any error during installation.

@kjedrzejewski
Copy link

I've uninstalled and installed newer version of Shiny:

Setting up Install Process
Examining shiny-server-1.4.0.721-rh5-x86_64.rpm: shiny-server-1.4.0.721-1.x86_64
Marking shiny-server-1.4.0.721-rh5-x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package shiny-server.x86_64 0:1.4.0.721-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================================================
 Package                                      Arch                                   Version                                       Repository                                                          Size
============================================================================================================================================================================================================
Installing:
 shiny-server                                 x86_64                                 1.4.0.721-1                                   /shiny-server-1.4.0.721-rh5-x86_64                                 205 M

Transaction Summary
============================================================================================================================================================================================================
Install       1 Package(s)

Total size: 205 M
Installed size: 205 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : shiny-server-1.4.0.721-1.x86_64                                                                                                                                                          1/1
User shiny already exists. Ensuring proper permissions on /home/shiny/.
shiny-server stop/waiting
shiny-server start/running, process 25936
  Verifying  : shiny-server-1.4.0.721-1.x86_64                                                                                                                                                          1/1

Installed:
  shiny-server.x86_64 0:1.4.0.721-1

Complete!

Nothing has changed. Apllication still hangs on loading screen. /opt/shiny-server/ext/pandoc/pandoc --version hangs too.

@fereshtehRS
Copy link
Contributor

Can you add the following to one of you Shiny applications that runs fine:

Sys.getenv()

so we can see what is the environment when Shiny Server runs.

@kjedrzejewski
Copy link

The output is:

CVS_RSH ssh
EDITOR vi
G_BROKEN_FILENAMES 1
HISTCONTROL ignoredups
HISTSIZE 1000
HOME /home/shiny
LANG C
LD_LIBRARY_PATH /usr/lib64/RRO-3.2.1/R-3.2.1/lib64/R/lib:/usr/local/lib64:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.85.x86_64/jre/lib/amd64/server
LESSOPEN |/usr/bin/lesspipe.sh %s
LN_S ln -s
LOGNAME shiny
MAIL /var/spool/mail/shiny
MAKE make
MKL_INTERFACE_LAYER GNU,LP64
MKL_THREADING_LAYER GNU
PAGER /usr/bin/less
PATH /usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/shiny/bin
PWD /home/shiny
RSTUDIO_PANDOC /opt/shiny-server/ext/pandoc
R_ARCH 
R_BROWSER /usr/bin/xdg-open
R_BZIPCMD /usr/bin/bzip2
R_DOC_DIR /usr/lib64/RRO-3.2.1/R-3.2.1/lib64/R/doc
R_GZIPCMD /bin/gzip
R_HOME /usr/lib64/RRO-3.2.1/R-3.2.1/lib64/R
R_INCLUDE_DIR /usr/lib64/RRO-3.2.1/R-3.2.1/lib64/R/include
R_LIBS_SITE 
R_LIBS_USER ~/R/x86_64-unknown-linux-gnu-library/3.2
R_PAPERSIZE a4
R_PDFVIEWER /usr/bin/xdg-open
R_PLATFORM x86_64-unknown-linux-gnu
R_PRINTCMD lpr
R_RD4PDF times,hyper
R_SESSION_TMPDIR /tmp/RtmpffMkW3
R_SHARE_DIR /usr/lib64/RRO-3.2.1/R-3.2.1/lib64/R/share
R_SYSTEM_ABI linux,gcc,gxx,gfortran,?
R_TEXI2DVICMD texi2dvi
R_UNZIPCMD /usr/bin/unzip
R_ZIPCMD /usr/bin/zip
SED /bin/sed
SHELL /bin/bash
SHINY_APP /srv/shiny-server/shiny_app_test
SHINY_GAID 
SHINY_MODE shiny
SHINY_PORT 60896
SHINY_SERVER_VERSION 1.4.0.721
SHINY_SHARED_SECRET 256cf26d7ded6b5d66f818927f4432e4
SHLVL 1
TAR /bin/gtar
USER shiny
WORKER_ID 0583648a54d66d8a

@fereshtehRS
Copy link
Contributor

The issue is most likely caused by the LANG setting. Please change that to "en_US.UTF-8". Make sure the change takes effect globally.

@kjedrzejewski
Copy link

Change of LANG variable helped. It looks everything works now. Thanks!

@fereshtehRS
Copy link
Contributor

Good to hear that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants