Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disconnected from Server in shinyapps, but local's working

Tags:

r

shiny

I deployed my Shiny code to shinyapps.io successful. My data has little much rows (over 190,000), these data's can display in my local PC but shinyapps cannot with 'Disconnected from the server.'

So I get Basic-plan and set memory size is xxxlarge and config some other settings.

But my apps shut-down with 'Disconnected from the server.' continue..

How can I set my server setting?

Please help me, and sorry my bad English.

Here is server log and url https://tmap.shinyapps.io/break_map/ (RN count 3~19, and all select mech_cd, then shut-down)

2016-08-24T05:34:08.539162+00:00 shinyapps[121340]: Server version: 0.4.5.2170
2016-08-24T05:34:08.539194+00:00 shinyapps[121340]: R version: 3.3.0
2016-08-24T05:34:08.539201+00:00 shinyapps[121340]: shiny version: 0.13.2
2016-08-24T05:34:08.539203+00:00 shinyapps[121340]: rmarkdown version: NA
2016-08-24T05:34:08.539204+00:00 shinyapps[121340]: knitr version: NA
2016-08-24T05:34:08.539212+00:00 shinyapps[121340]: RJSONIO version: NA
2016-08-24T05:34:08.539204+00:00 shinyapps[121340]: jsonlite version: 0.9.19
2016-08-24T05:34:08.539212+00:00 shinyapps[121340]: htmltools version: 0.3.5
2016-08-24T05:34:08.754267+00:00 shinyapps[121340]: Using jsonlite for JSON processing
2016-08-24T05:34:08.758255+00:00 shinyapps[121340]: 
2016-08-24T05:34:08.758256+00:00 shinyapps[121340]: Starting R with process ID: '17'
2016-08-24T05:34:08.964272+00:00 shinyapps[121340]: Loading required package: gsubfn
2016-08-24T05:34:08.970689+00:00 shinyapps[121340]: Loading required package: proto
2016-08-24T05:34:09.000933+00:00 shinyapps[121340]: Warning: no DISPLAY variable so Tk is not available
2016-08-24T05:34:09.011202+00:00 shinyapps[121340]: Loading required package: RSQLite
2016-08-24T05:34:09.016999+00:00 shinyapps[121340]: Loading required package: DBI
2016-08-24T05:34:10.597571+00:00 shinyapps[121340]: Loading required package: tcltk
2016-08-24T05:34:12.215392+00:00 shinyapps[121340]: 
2016-08-24T05:34:12.215396+00:00 shinyapps[121340]: Listening on http://0.0.0.0:60468
like image 323
unmin baek Avatar asked Aug 24 '16 07:08

unmin baek


People also ask

Why does my app work locally but not on my shiny server?

Your application may be dependent on packages that are installed and loaded in your environment, but aren't installed for the correct user on the Shiny Server. Make sure that all necessary packages are installed for the same user set under run_as in your Shiny Server configuration file.

Why do I keep getting disconnected in fall guys?

It may indicate that you're using a faulty or outdated network driver. If you don't remember the last time you updated your network driver, you need to have a check right now.

Why is my shiny app not publishing?

Your application may require more resources than are available in the instance or be failing when it comes under the load of several users. This could happen for a variety of reasons, including but not limited to: Forgetting to close each database connection after loading in data (the connection limit may be hit)


3 Answers

If there are no errors in the logs, then you are likely running into one of two problems: You are either running out of memory, or your application startup is timing out.

Try reducing your data to just a few rows and see if it displays. If you can get something to display, then you know it's a data size issue. Next, try increasing the application startup time under Settings -> Advanced -> Startup Timeout.

If that doesn't fix it, you may be running out of memory. Make sure you're on the Large setting under Settings -> General -> Instance Size.

shinyapps.io only allows up to 1GB for the free tier, so to get around it you'll either need to find a way of reducing your data or getting a paid plan: http://shiny.rstudio.com/articles/shinyapps.html

like image 191
bdetweiler Avatar answered Oct 06 '22 06:10

bdetweiler


I had faced a similar issue, adding a few pointers which might help someone.

Load you application and try analysing the requests from the browser network logs section.

On doing so i noticed two of my requests from the Shiny app were pretty heavy and taking a long while ~25-30s. After a while connection would get terminated with the error as below:

{"type":"close","code":3000,"reason":"No response from heartbeat","wasClean":true}

Shiny has few params related to heartbeat.

http://docs.rstudio.com/shiny-server/#sockjs_heartbeat_delay

Setting them is what helped me. Increase the value of 'sockjs_heartbeat_delay' in shiny-server.conf to a large number and the disconnect issue was not seen anymore.

like image 44
minion Avatar answered Oct 06 '22 05:10

minion


You might be using setwd() in your code. Delete that line or comment it out so you can later choose to run it when running your app locally. Then try again.

#Set wd if running code locally----
#setwd("/Users/Dropbox/YourPathHere/")
like image 23
jesstme Avatar answered Oct 06 '22 04:10

jesstme