How to refresh app files when 'touch restart.txt' has no effect?

888 views
Skip to first unread message

Matthew Leonawicz

unread,
Mar 5, 2014, 4:25:59 PM3/5/14
to shiny-...@googlegroups.com
I am having this trouble with some of my apps which source some externalized R files outside/above the shinyServer call. This used to do the trick but it no longer seems to have any effect, either on my apps on the Spark server, or on our local server hosted using the most up to date copy of shiny server. Changes to browser content from updated files do not show up in the browser. I can even delete the files entirely but they remain cached and their old content still shows in the app. In both places I am using a recent pull of Shiny package 0.8.0.99 if that could be an issue. My files are actually loaded at the top of ui.R, as follows:

myfile <- source("myfile.R")$value
shinyUI(pageWithSidebar(
...

And 'myfile' is referenced later under mainPanel() to display some generic content.

Thanks,
Matt

Joe Cheng

unread,
Mar 6, 2014, 7:54:32 PM3/6/14
to Matthew Leonawicz, shiny-...@googlegroups.com, Jeff Allen
Do you update your app by deleting the app directory and replacing it?
If so, I suspect the problem may be that the R process's current
working directory is a deleted directory and it doesn't even know to
look in the new directory for restart.txt.

(Jeff, does this sound familiar?)
> --
> You received this message because you are subscribed to the Google Groups
> "Shiny - Web Framework for R" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to shiny-discus...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

Matthew Leonawicz

unread,
Mar 6, 2014, 9:25:36 PM3/6/14
to shiny-...@googlegroups.com, Matthew Leonawicz, Jeff Allen
Hi Joe,

I update apps, both on Spark and on our local shiny server, by an ssh onto the server, going into the main shiny apps folder where all the different apps are stored, and doing running a git pull from our shiny apps GitHub repo at the terminal. I always work on the apps on local repos, push to Github, and later pull down to the two servers. The only time I modify anything on the servers at the terminal is, for example, doing a touch restart.txt in an app directory, which used to trigger all files in an app to be updated in the app, but lately it seems to have no effect.

I could be wrong, but if I recall correctly, when this used to work, if I did touch restart.txt in an app directory while I had the app running in the browser, the process would stop and the browser would gray out. This no longer occurs. I hope I'm not imagining that; I think that used to be the case.

Matt

Matthew Leonawicz

unread,
Mar 6, 2014, 9:55:49 PM3/6/14
to shiny-...@googlegroups.com, Matthew Leonawicz, Jeff Allen
I should add that I virtually never need to do a 'touch restart' at all for any of my apps at any time following any git pull where any subset of app files have been modified. So I don't want to give the wrong impression that I rely on 'touch restart' to force update an app as standard procedure. It's rarely necessary. It's only been necessary once in a while, and only recently that it no longer has any effect.

Matt

Jeff Allen

unread,
Mar 7, 2014, 10:43:07 AM3/7/14
to Matthew Leonawicz, shiny-...@googlegroups.com, Fereshteh Karimeddini
Hi Matthew,

I'm not sure what's going on here, unfortunately. One clarification is that I think you may be mistaken about restart.txt forcefully closing connections. The way we have restart.txt setup is to leave the existing connections alone (still connected to the older process running with the older assets), but route all incoming traffic to a new process with the new code. So your old connections should continue to live on indefinitely after a restart.

I assume you're refreshing the tab with your Shiny app and still seeing the old assets? In accordance with the description above, we wouldn't expect that an existing connection would see any updates even after a restart.

Can you try clearing your browser's cache then reloading the page? And is it the server.R and UI.R files that you're updating, or some other assets in your application?

Thanks,
Jeff

Thursday, March 06, 2014 8:25 PM
Hi Joe,

I update apps, both on Spark and on our local shiny server, by an ssh onto the server, going into the main shiny apps folder where all the different apps are stored, and doing running a git pull from our shiny apps GitHub repo at the terminal. I always work on the apps on local repos, push to Github, and later pull down to the two servers. The only time I modify anything on the servers at the terminal is, for example, doing a touch restart.txt in an app directory, which used to trigger all files in an app to be updated in the app, but lately it seems to have no effect.

I could be wrong, but if I recall correctly, when this used to work, if I did touch restart.txt in an app directory while I had the app running in the browser, the process would stop and the browser would gray out. This no longer occurs. I hope I'm not imagining that; I think that used to be the case.

Matt

On Thursday, March 6, 2014 3:54:32 PM UTC-9, Joe Cheng [RStudio] wrote:
Thursday, March 06, 2014 6:54 PM

Fereshteh Karimeddini

unread,
Mar 7, 2014, 11:00:48 AM3/7/14
to shiny-...@googlegroups.com, Matthew Leonawicz, Fereshteh Karimeddini
Matthew,

To add to Jeff's response, I tested this and couldn't see the problem you are seeing; I was able to see the updates on my open application after a refresh of the page. May be you are running into a specific case that causes problem. If you have a simple reproducible case that you could share with us, it would be great.

And as Jeff said, you shouldn't see the page greying out. Only a new R process starts when you refresh the page. 

Fereshteh

Matthew Leonawicz

unread,
Mar 7, 2014, 1:58:53 PM3/7/14
to shiny-...@googlegroups.com, Matthew Leonawicz, Fereshteh Karimeddini
Hi all,

Thanks, I have a better understanding of how touch restart works now, and that is very helpful. I have not been able to reproduce the problem, but taking a fresh start and redoing some of my recent changes seems to have fixed the problem. I think this one just points to user error on my part, just cannot figure out what I did. I apologize for the potentially wasted time.

Matt

Fereshteh Karimeddini

unread,
Mar 7, 2014, 2:17:05 PM3/7/14
to shiny-...@googlegroups.com, Matthew Leonawicz, Fereshteh Karimeddini
No worries. Glad that it is working, but probably there is an edge case that this won't work properly. In case you run into it again we would be happy to hear about it.

Fereshteh
Reply all
Reply to author
Forward
0 new messages