Shiny Server plots to be auto-refreshed with reactive and invalidateLater

Has anyone tried this before? I have a plot which auto-refreshes itself and update with the latest data on each refresh. It looks perfectly OK at first. I have put that auto-refresh for every minute (60seconds). Things are OK for the next about 30 minutes, but after which the plot does not appear, and that whole screen area starts shaking to the right and left continuously. What are the causes? Is it memory issue?

code sample below:

UpdatedTemperature <- reactive({
plot_xts <- cbind(Temp1,Temp2)  

output$abc_dygraph <- renderDygraph({
  plot_xts <- UpdatedTemperature()
  graph <- dygraph(plot_xts) %>%
    dyRangeSelector() %>%
    dyLegend(width = 1240)
Warning: Error in load: error reading from connection
  113: load
  112: <reactive>
   96: UpdatedTemperature
   95: func
   82: origRenderFunc
   81: output$abc_dygraph
    1: runApp

I managed to retrieve some logs when the issue appears. It seems the issue comes from loading the abc.RData. My question is: why would it have issue loading that RData file after some time? for the first 30 minutes, it is all OK, and furthermore, that RData file size remains the same for now.

Maybe it's creating a new file connection each time you load, and the old connections are not getting freed up, particularly if there was an error on load. You could try explicitly opening a file connection to use and then close it afterwards.

Or you could try closing all connections from time to time.


Thanks woodward for your suggestion, I will try that and let you know its outcome.

it does not help. I still faced the same problem.

As I am loading in RData file, I do not see why it mentions of "error reading from connection". Are there any other alternatives of clearing the memory, since mine is a per minute basis of loading that RData file, and it may incur much memory usage.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.