Hi there! I'm looking for some assistance on an issue I've been having on my first attempts on building a shiny app.
The app deploys well and it doesn't take too long to do so. However, after one round of running the deployed app (which shows the result perfectly), it kind of crashes, showing the sign "Disconnected from the server", and I can't use it unless I refresh the page. I read that this could happen if the processes run are too complex or the datasets generated are really big.
While the original input data is not really big (maybe 5 Mb tops, all together), some files that are generated within the server section may be big (a raster, a masked raster, two kriging processes, one over a prediction grid and another on a focal point, and a cross validation model). Lastly, Shinyapps.io classified my app as large.
Could these things be an issue? What could be an approach to solve this?
Go to shinyapps.io and click on the name of the app in the table, then on the logs. This will show why the app crashed. On the free tier apps are limited to 1GB of RAM which isn't much and if that's the problem you'll see an out of memory error. There's not much you can do to fix it other than paying for a higher tier or hosting it elsewhere. If the logs don't say anything about memory, post them here.
Hi Simon_Smart, thanks for you answer! I just entered the app and ran it three times. In the fourth attempt I got the message "Disconnected from the server".
Checking the app log, I find no messages pointing to an error. I copy here the last working run log and the messages when it crashed. As you can see, it just halted:
2025-01-17T11:26:40.843266+00:00 shinyapps[13737226]: variog: computing omnidirectional variogram
2025-01-17T11:26:40.848603+00:00 shinyapps[13737226]: variofit: covariance model used is exponential
2025-01-17T11:26:40.854233+00:00 shinyapps[13737226]: variofit: weights used: npairs
2025-01-17T11:26:40.860042+00:00 shinyapps[13737226]: variofit: minimisation function used: optim
2025-01-17T11:26:40.865395+00:00 shinyapps[13737226]: Warning in variofit(emp_variogram, cov.model = "exponential") :
2025-01-17T11:26:40.871042+00:00 shinyapps[13737226]: initial values not provided - running the default search
2025-01-17T11:26:40.876734+00:00 shinyapps[13737226]: variofit: searching for best initial value ... selected values:
2025-01-17T11:26:40.882921+00:00 shinyapps[13737226]: sigmasq phi tausq kappa
2025-01-17T11:26:40.888458+00:00 shinyapps[13737226]: initial.value "0.26" "20.03" "0" "0.5"
2025-01-17T11:26:40.893902+00:00 shinyapps[13737226]: status "est" "est" "est" "fix"
2025-01-17T11:26:40.899490+00:00 shinyapps[13737226]: loss value: 0.457697274046858
2025-01-17T11:26:40.904721+00:00 shinyapps[13737226]: krige.conv: model with constant mean
2025-01-17T11:26:42.848346+00:00 shinyapps[13737226]: krige.conv: Kriging performed using global neighbourhood
2025-01-17T11:26:42.854603+00:00 shinyapps[13737226]: krige.conv: model with constant mean
2025-01-17T11:26:42.860057+00:00 shinyapps[13737226]: krige.conv: Kriging performed using global neighbourhood
END OF THE LAST WORKING RUN______________________________
2025-01-17T11:26:53.842868+00:00 shinyapps[13737226]: variog: computing omnidirectional variogram
2025-01-17T11:26:53.848459+00:00 shinyapps[13737226]: variofit: covariance model used is exponential
2025-01-17T11:26:53.853663+00:00 shinyapps[13737226]: variofit: weights used: npairs
2025-01-17T11:26:53.858776+00:00 shinyapps[13737226]: variofit: minimisation function used: optim
2025-01-17T11:26:53.863905+00:00 shinyapps[13737226]: Warning in variofit(emp_variogram, cov.model = "exponential") :
2025-01-17T11:26:53.869031+00:00 shinyapps[13737226]: initial values not provided - running the default search
2025-01-17T11:26:53.874499+00:00 shinyapps[13737226]: variofit: searching for best initial value ... selected values:
2025-01-17T11:26:53.879903+00:00 shinyapps[13737226]: sigmasq phi tausq kappa
2025-01-17T11:26:53.885277+00:00 shinyapps[13737226]: initial.value "0.16" "15.02" "0" "0.5"
2025-01-17T11:26:53.890777+00:00 shinyapps[13737226]: status "est" "est" "est" "fix"
2025-01-17T11:26:53.896129+00:00 shinyapps[13737226]: loss value: 0.356647500103868
2025-01-17T11:26:53.902130+00:00 shinyapps[13737226]: krige.conv: model with constant mean
END OF THE ROUND IT HALTED____________________________________________
Just a quick note, I tried taking away the cross validation from the app (this is why there are no messages indicating that process running), to check if it would improve its performance. It kind of did (it allowed me to run it three times satisfactorily), but still crashed eventually.