ShinyApp : Connection Reset By Peer - r

The shinyapp I built earlier was running fine in my old laptop. Recently I got a new laptop with Windows10. After setting up everything, I tried to run the app but it the browser opens and closes immediately with the error :
Listening on http://127.0.0.1:5004
ERROR: [on_request_read] connection reset by peer
I have also set chrome as default browser....
I deployed this app in shinyapps.io it is working fine there.
I tried few more simple apps in Rstudio but the same issue coming. Looks like the issue is more related to some setting in Windows10. Can someone help me please.
Thanks in Advance.....

Without details on the specific code, I'd share my personal experience with the same error for your reference. In my case, I used RStudio to create a shiny app that save data to a local directory on my computer, while I told R to output files to directory "response", I hadn't created such directory under the working directory so came the error. Simply creating the sub directory named "response" solve this right away. Or for moving your project files to different places in the future, you can just check whether the folder exists, if not, create one shall save you a lot of time.

Related

Error when hosting shiny app on DigitalOcean ubuntu server

I have built a shiny app that I have successfully deployed to shinyapps.io in the past. However, since I need better hosting resources and a custom domain, and the only shinyapps.io option allowing for the latter is out of my price range, I am trying to host the app on a digital ocean ubuntu droplet.
I have been able to set up shiny server on my droplet using this tutorial. The sample apps work just fine. However, when I try to access my own app (having uploaded it into a directory within my shiny server) I get the following error:
An error has occurred! An error has occurred. Check your logs or
contact the app author for clarification.
I've googled for a solution and have tried moving the data cleaning steps from outside the server/ui function into the functions. I have also checked that RStudio on the droplet has all the required packages installed and that seems to be the case. I have checked the logs but there is nothing about this app or the error in the shiny server log. My app works fine both on my local computer and on shinyapps.io. I'd really appreciate any pointers (and apologies if I am duplicating but I haven't found anything that seems directly applicable).
Okay - it turns out one of the packages was indeed missing. I had installed them all using my non-root user with admin privileges, and was under the impression they were available globally. One of the packages was not available to root and installing it there resolved the problem.

R studio not responding

My RStudio is opening multiple processes(opening R Studio in different windows) when I open just one. I am not able to open any project. It becomes unresponsive. I tried using in compatibility mode, running as admin and also uninstalled. But still,(here's the image) the same problem persists. Can someone please help me?
Before you reinstall everything, which may take a lot of time, it is worth removing application data, which is a cache R keeps of last sessions etc. It involves settings such as information from last session, etc which RStudio tries to reopen every time you open it.
For app data, look under your user folder which must be somewhere like
c:\Users\<your_user_here\AppData\Local
c:\Users\<your_user_here\AppData\Local\LocalLow
c:\Users\<your_user_here\AppData\Roaming
Delete every subfolder called R, RStudio-Desktop or RStudio under these folders. Don't worry, you won't lose your source program files and projects. It may help you recover everything without having to start over from scratch.

Shiny App Deployment - Error (cannot change working directory)

I have been trying to deploy a shiny app using rsconnect: deployapp(appname = "myapp"). I get the following message at the command prompt:
Application successfully deployed to https://sitename.shinyapps.io/MyApp/
However, when I launch the app, I get the error message:
ERROR: cannot change working directory
Based on resolution to similar problem on both Stackoverflow and googleforum, I tried using both absolute and relative paths in setwd(). Following are the error messages with both absolute and relative paths to setwd():
Error in setwd("~/Data/Projects/MyApp"): cannot change working directory
Error in setwd("C:/Users/Documents/Data/Projects/MyApp"): cannot change working directory
Any suggestions to resolve the issue would be greatly appreciated. thanks in advance!
shinyapps.io is a virtualized container service running shiny apps.
It is most likely linux based. I do not have the time to write up a
shiny app to confirm that but like most virtualized containers let
us assume it is.
With 1 being say true. Paths like C:/ do not make sense in the linux world.
Again with 1 in mind the directory structure of ~/Data might not exist.
Work with relative paths ~/ Also put a checkguard with dir.exists() and dir.create
dirname <- '~/Data/Projects/MyApp'
if (!dir.exists(dirname))dir.create(dirname,recursive=TRUE)
FYI I don't really think your should be doing any setwd() for shinyapps. If the data file is is in ~/Data/Projects/Myapp/somedata.csv you can do a direct read in the app as read.csv('somedata.csv').
The server directory structure is in the form of /srv/shiny-server/MyShinyApp when you upload
Error in setwd("c:/nonexistent_directory_path") : cannot change working directory
This error message will be generated when a directory does not exist. Verify that directory does in fact exist (ie: check spelling, typos).

RStudio project "cannot find the file specified" on R session restart

I am getting strange and annoying behavior in one (yes, only one) of my RStudio projects. Whenever I restart the R session within this project, I can no longer save any of the files, and when I try to (or RStudio tries to automatically) I get a popup error saying "The system cannot find the file specified" and I have to reopen the project and all of the R scripts.
I looked at the log file, and I see a lot of the following error:
07 Oct 2015 00:52:05 [rsession-Mark] ERROR system error 5 (Access is denied) [path=C:/Users/Mark/GoogleDrive/Research/CEQUAL_event/.Rproj.user/5E5F98D9/sdb/s-26E44539/lock_file];
OCCURRED AT: bool rstudio::core::FilePath::exists() const C:\Users\Administrator\rstudio\src\cpp\core\FilePath.cpp:308;
LOGGED FROM: bool rstudio::core::FilePath::exists() const C:\Users\Administrator\rstudio\src\cpp\core\FilePath.cpp:308
It looks like the problem may be in the .Rproj.user folder. So I deleted that and let RStudio regenerate it, but the behavior started right back up again.
I am using Windows 7, RStudio version 0.99.441, and R version 3.2.2.
I think #Jack Wasey is right: Google drive locks files during sync. This causes many issues with other programs as well. There are alternatives from companies that do file syncing for a living, such as dropbox, whose clients don't lock files. With google drive you only have the option to use selective sync and exclude every .Rproj.user folder. Once the RStudio's database is corrupted, moving the project out of the Google drive folder won't be enough - you will need to delete/rename it to have RStudio fix its database.
Summary:
Copy contents from all unsaved files to a temp file outside of RStudio (while clicking away the error message every other second)
Quit Rstudio
Pause Google drive syncing
Rename (or move/delete) the hidden .Rproj.user folder in your project
Reopen the project in Rstudio
Exclude the new .Rproj.user folder from syncing with Google drive (Preferences -> sync only these folders)
Remember that Google drive is free / Become an awesome google developer and fix the issue once and for all
May not be related but might be helpful to someone else. I was getting the same error (over and over) and finally realized that I had an R session open from days ago, that had eventually gotten stuck. It was running in the background with a "Fatal Error" message waiting for me to click OK. When I closed that session everything started working again.
This was happening to me as well, but curiously only when I was using Project files (.Rproj - not stand alone R scripts). It was driving me crazy.
I found that buried in the settings (Tools -> Global Options -> Git/SVN) there was a setting "Enable Version Control Interface for RStudio Projects). I guess I had turned that option on when I was messing with my settings and then forgot about it since I don't normally use project files.
What worked for me was I noticed DescTools package I installed caused it, though it served the purpose I installed it - fetched me mode value without going through mode functions. I then deleted the line I got the install.package, re-saved the project (ctrl S) and I could knit it.
Bottom line, read the error message soon as the box pops up, it's going to give you a hint of what line is causing the issue.
I hope this works. Enjoy

Strange R message: Persistent UI failed to open file

I have just updated my R to version 3.1.1 on my Mac machine, and since then have started getting this strange message when running analyses.
Persistent UI failed to open file ..../org.R-project.R.savedState/window_2.data: No such file or directory (2)
Where I have written the .... there is the rest of the file directory, but I didn't think it necessary to add in.
There does not appear to be anything specific that sets off this error. I am usually running a number of R windows at once - which are running difference analyses (around 6) and the error appears across all windows at roughly the same time I think, I am not usually watching the analyses tick over.
It doesn't kill the analyses. And I haven't found it causing any problems.
I am just curious what it means, and how I should fix it?
Thanks,
Sam
This is pretty old, but I just ran in to the same problem.
You see this message because R does not have permission to change your ~/Library/Shared Application State directory.
If you want to change it, 1 just navigate to the folder, 2 right click it, and 3 uncheck the lock checkbox or change the permissions to that folder.
I don't mind the R error message because I hate OSX writing all the current application states to that folder.

Resources