App deployed to shinyappsio keeps waking up with no user connection

I made a shiny app and I'm hosting it on ShinyApps.io using the free tier. Although there are no users connecting to this app, it keeps waking up and accruing active time. I'd like to keep it idle until someone connects to it (what should be the default as far as I know)

I tried removing and deploying the app again. I'm suspecting something in my code might be causing this auto-wakeup. I looked into my (long) code an can't seem to find anything. I'm not really sure how to make a reproducible example to have a comparable situation to my case. The log output is copied below.

2019-08-20T15:43:54.819756+00:00 shinyapps[1053041]: Server version: 1.7.6-6
2019-08-20T15:43:54.819791+00:00 shinyapps[1053041]: R version: 3.5.3
2019-08-20T15:43:54.819793+00:00 shinyapps[1053041]: shiny version: 1.3.2
2019-08-20T15:43:54.819795+00:00 shinyapps[1053041]: httpuv version: 1.5.1
2019-08-20T15:43:54.819801+00:00 shinyapps[1053041]: rmarkdown version: (none)
2019-08-20T15:43:54.819802+00:00 shinyapps[1053041]: knitr version: (none)
2019-08-20T15:43:54.819814+00:00 shinyapps[1053041]: jsonlite version: 1.6
2019-08-20T15:43:54.819822+00:00 shinyapps[1053041]: RJSONIO version: (none)
2019-08-20T15:43:54.820032+00:00 shinyapps[1053041]: Using pandoc at /opt/connect/ext/pandoc2
2019-08-20T15:43:54.819845+00:00 shinyapps[1053041]: htmltools version: 0.3.6
2019-08-20T15:43:54.819759+00:00 shinyapps[1053041]: LANG: en_US.UTF-8
2019-08-20T15:43:55.062597+00:00 shinyapps[1053041]: Using jsonlite for JSON processing
2019-08-20T15:43:55.070654+00:00 shinyapps[1053041]: 
2019-08-20T15:43:55.070656+00:00 shinyapps[1053041]: Starting R with process ID: '24'
2019-08-20T15:43:55.103166+00:00 shinyapps[1053041]: 
2019-08-20T15:43:55.103169+00:00 shinyapps[1053041]: Listening on http://127.0.0.1:39169
2019-08-20T15:43:57.325083+00:00 shinyapps[1053041]: 
2019-08-20T15:43:57.325087+00:00 shinyapps[1053041]: Attaching package: ‘dplyr’
2019-08-20T15:43:57.325089+00:00 shinyapps[1053041]: 
2019-08-20T15:43:57.325925+00:00 shinyapps[1053041]: The following objects are masked from ‘package:stats’:
2019-08-20T15:43:57.325927+00:00 shinyapps[1053041]: 
2019-08-20T15:43:57.325928+00:00 shinyapps[1053041]:     filter, lag
2019-08-20T15:43:57.325930+00:00 shinyapps[1053041]: 
2019-08-20T15:43:57.327348+00:00 shinyapps[1053041]: The following objects are masked from ‘package:base’:
2019-08-20T15:43:57.327350+00:00 shinyapps[1053041]: 
2019-08-20T15:43:57.327353+00:00 shinyapps[1053041]: 
2019-08-20T15:43:57.333475+00:00 shinyapps[1053041]: Loading required package: ggplot2
2019-08-20T15:43:57.481588+00:00 shinyapps[1053041]: Loading required package: magrittr
2019-08-20T15:43:57.327352+00:00 shinyapps[1053041]:     intersect, setdiff, setequal, union
2019-08-20T16:29:06.577793+00:00 shinyapps[1053041]: Server version: 1.7.6-6
2019-08-20T16:29:06.577832+00:00 shinyapps[1053041]: LANG: en_US.UTF-8
2019-08-20T16:29:06.577833+00:00 shinyapps[1053041]: R version: 3.5.3
2019-08-20T16:29:06.577834+00:00 shinyapps[1053041]: shiny version: 1.3.2
2019-08-20T16:29:06.577835+00:00 shinyapps[1053041]: httpuv version: 1.5.1
2019-08-20T16:29:06.577853+00:00 shinyapps[1053041]: rmarkdown version: (none)
2019-08-20T16:29:06.577888+00:00 shinyapps[1053041]: knitr version: (none)
2019-08-20T16:29:06.577898+00:00 shinyapps[1053041]: jsonlite version: 1.6
2019-08-20T16:29:06.577932+00:00 shinyapps[1053041]: RJSONIO version: (none)
2019-08-20T16:29:06.577939+00:00 shinyapps[1053041]: htmltools version: 0.3.6
2019-08-20T16:29:06.578145+00:00 shinyapps[1053041]: Using pandoc at /opt/connect/ext/pandoc2
2019-08-20T16:29:06.921244+00:00 shinyapps[1053041]: Using jsonlite for JSON processing
2019-08-20T16:29:06.928195+00:00 shinyapps[1053041]: 
2019-08-20T16:29:06.967209+00:00 shinyapps[1053041]: 

I expect the app to stay idle until someone connects to it and not use limited compute time on the server. Have you had a similar experience with Shinyapps? I posted the same question in stackoverflow, but I didn't get any insights there.

Thanks!

I have the same!!! In quite regular intervals.
I know that no user is connected as I include a "print("Application started, TempDir = ....") in my server and this line does not appear.
For a while it was often linked to "Starting R with process ID: '19'", now it is most often process ID 24.

Happened in both, free version and now "Basic Plan".
Often this are the small spikes in the application usage plot.

I always thought Shinyapps.io comes to visit from time to time, brushes trough the environment, checks if everything was deleted and is ready for the next user...

I also have periodic spikes. From the logs, it looks like the app wakes up, sets up the workspace, starts "listening" and logs out after idle time limit is over. It accumulates precious compute time though (especially for the free tier), so any insight to prevent this behavior is appreciated!

How do you know that no one is connecting to your app? My first suspicious would be that it's getting indexed by a search engine.

1 Like

Hmm this could be!?
Are the pages indexed, will their content be available to Google search once?
I just tested it, and yes when I start the app and instantly (while it still says loading) close the tab the report in the log looks quite similar.
If this is the case, is there anything that can be done to either help or stop the indexing (as adding a robots.txt) to offer the search engines something telling them they where there already or to know what they should index?

See also this post: Search engine optimization for Shiny app

Josh: "We do not allow crawlers to start up applications"
JCheng: "I've heard rumors that Google crawlers can fully emulate web browsers in order to get at the content of single-page apps like Shiny"

In my case, I have a Google analytics tracker deployed with the app. I can't see anybody connecting during the spikes. I'm not sure if search indexing would trigger the tracker though, so I might be looking at a false negative.

On the other hand: This behaviour seems to need an active app. I have another one, that isn't used anymore. There I have 0 mins usage the last months.

That's why I thought that whenever you use the app, somehow the system comes to visit, to restart the R-sessions or to check the memory usage and delete temporary data.