Problem with Shiny App in Shinyapps.io

,

Hello,

I am having a problem with a shiny app when I deploy it in shinyapps.io. Depends on the order of my request my app disconnect or not. What could it be? https://dsssmn.shinyapps.io/appWRF_AWS/

First you have to download some data from the first tab (choose data from january and 01H dataset and then click on "DESCARGA DE DATOS". When this process finish go to the second tab and:

  • If you click first in 'Grafica Mapa' and then in 'Grafica Serie' the app disconnect.
  • If you click fist in 'Grafica Serie' and then in 'Grafica Mapa' the app doesn't disconnect.

PLEASE, be patient when clicking on bottons.

Could someone help me to understan what is going on?

Thank you,

Lorena

If you run the app, trigger the disconnect and then check the application's log on shinyapps.io, do you find any error messages in the log?

To expand on prubin's post - Go to https://www.shinyapps.io/admin/#/dashboard and click on the name of your app in the table, then go to Logs and you should see an error message of some kind.

Thank you for your replies. I don't get any error message in the LOG. That is strange.

Kind regards,
Gonzalo

We cannot debug the application without seeing the code. One possibility might be to take the server code triggered by clicking 'Grafica Serie' and surround it with a tryCatch() call containing an error handler that pops up a message regarding the error and, hopefully, leaves the application running.

Ok, I will see. I think it is something in shinyapps.io the problem, because when I run the app locally I don't have that problem of disconnect.

-Lorena

At this moment I have this LOG:

2025-02-21T11:35:37.857196+00:00 shinyapps[7066955]:
2025-02-21T11:35:37.862443+00:00 shinyapps[7066955]: The following objects are masked from ‘package:dplyr’:
2025-02-21T11:35:37.867819+00:00 shinyapps[7066955]:
2025-02-21T11:35:37.872812+00:00 shinyapps[7066955]: first, last
2025-02-21T11:35:37.878144+00:00 shinyapps[7066955]:
2025-02-21T11:35:37.883609+00:00 shinyapps[7066955]: terra 1.7.65
2025-02-21T11:35:37.918702+00:00 shinyapps[7066955]:
2025-02-21T11:35:37.928507+00:00 shinyapps[7066955]: Attaching package: ‘terra’
2025-02-21T11:35:37.933677+00:00 shinyapps[7066955]:
2025-02-21T11:35:37.940828+00:00 shinyapps[7066955]: The following object is masked from ‘package:zoo’:
2025-02-21T11:35:37.946140+00:00 shinyapps[7066955]:
2025-02-21T11:35:37.951524+00:00 shinyapps[7066955]: time<-
2025-02-21T11:35:37.956871+00:00 shinyapps[7066955]:
2025-02-21T11:35:37.963925+00:00 shinyapps[7066955]: The following object is masked from ‘package:tidyr’:
2025-02-21T11:35:37.969001+00:00 shinyapps[7066955]:
2025-02-21T11:35:37.974111+00:00 shinyapps[7066955]: extract
2025-02-21T11:35:37.979164+00:00 shinyapps[7066955]:
2025-02-21T11:35:37.984477+00:00 shinyapps[7066955]: The following object is masked from ‘package:patchwork’:
2025-02-21T11:35:37.989671+00:00 shinyapps[7066955]:
2025-02-21T11:35:37.995093+00:00 shinyapps[7066955]: area
2025-02-21T11:35:38.000158+00:00 shinyapps[7066955]:
2025-02-21T11:35:38.005796+00:00 shinyapps[7066955]: The following object is masked from ‘package:fields’:
2025-02-21T11:35:38.011113+00:00 shinyapps[7066955]:
2025-02-21T11:35:38.016259+00:00 shinyapps[7066955]: describe
2025-02-21T11:35:38.021300+00:00 shinyapps[7066955]:
2025-02-21T11:35:38.026608+00:00 shinyapps[7066955]: The following object is masked from ‘package:shinyWidgets’:
2025-02-21T11:35:38.032806+00:00 shinyapps[7066955]:
2025-02-21T11:35:38.037797+00:00 shinyapps[7066955]: panel
2025-02-21T11:35:38.042972+00:00 shinyapps[7066955]:
2025-02-21T11:35:38.048099+00:00 shinyapps[7066955]: System has not been booted with systemd as init system (PID 1). Can't operate.
2025-02-21T11:35:38.053225+00:00 shinyapps[7066955]: Failed to connect to bus: Host is down
2025-02-21T11:35:38.058294+00:00 shinyapps[7066955]: Warning in system("timedatectl", intern = TRUE) :
2025-02-21T11:35:38.063385+00:00 shinyapps[7066955]: running command 'timedatectl' had status 1
2025-02-21T11:35:38.068672+00:00 shinyapps[7066955]:
2025-02-21T11:35:38.073772+00:00 shinyapps[7066955]: Attaching package: ‘lubridate’
2025-02-21T11:35:38.078898+00:00 shinyapps[7066955]:
2025-02-21T11:35:38.084114+00:00 shinyapps[7066955]: The following objects are masked from ‘package:terra’:
2025-02-21T11:35:38.089430+00:00 shinyapps[7066955]:
2025-02-21T11:35:38.094763+00:00 shinyapps[7066955]: intersect, union
2025-02-21T11:35:38.099932+00:00 shinyapps[7066955]:
2025-02-21T11:35:38.105133+00:00 shinyapps[7066955]: The following objects are masked from ‘package:raster’:
2025-02-21T11:35:38.110295+00:00 shinyapps[7066955]:
2025-02-21T11:35:38.115376+00:00 shinyapps[7066955]: intersect, union
2025-02-21T11:35:38.120516+00:00 shinyapps[7066955]:
2025-02-21T11:35:38.125599+00:00 shinyapps[7066955]: The following objects are masked from ‘package:base’:
2025-02-21T11:35:38.131008+00:00 shinyapps[7066955]:
2025-02-21T11:35:38.136200+00:00 shinyapps[7066955]: date, intersect, setdiff, union
2025-02-21T11:35:38.141649+00:00 shinyapps[7066955]:
2025-02-21T11:35:38.147902+00:00 shinyapps[7066955]:
2025-02-21T11:35:38.153301+00:00 shinyapps[7066955]: Listening on http://127.0.0.1:41359

I was going to try again

It's really weird that in the local environment the app works excellent, but in shinyapps.io I get this disconnection problem.

Googling the error message about "timedatectl" turns up a number of problem reports that seem to be related to whether the environment in which R is running has a timezone parameter (TZ) set. That has me wondering whether your code includes any operations that would depend on the current time zone (which presumably would be different on the shinyapps server than on your local system).

Paul, that is a great observation. Yes, could be a difference on that. I am in SouthAmerica, specifically in Argentina. The server I think that should be in USA. I am not sure if that could making a problem. I use timedate in my app. Do you know if there is some way to adapt the app to take my timezome?

Thanks!

I put this at the beginning of my code: Sys.setenv(TZ = "America/Argentina/Buenos_Aires")

But I am still getting the disconnection.

This is also another part of LOG:

2025-02-21T18:41:14.518759+00:00 shinyapps[7066955]: [1] "Group 1 : name= id= 3211264 fqgn= " " nvars= 18 ndims= 3 dimid="
2025-02-21T18:41:14.523579+00:00 shinyapps[7066955]: [1] 0 1 2
2025-02-21T18:41:14.528022+00:00 shinyapps[7066955]: [1] "nc_open: getting dim info for dim number 1 in group " " dim ID= 0"
2025-02-21T18:41:14.532841+00:00 shinyapps[7066955]: [1] ".....dim name is time id= 0 len= 1 dimvarid= 14"
2025-02-21T18:41:14.537330+00:00 shinyapps[7066955]: [1] "nc_open: getting dimvar info for dim time"
2025-02-21T18:41:14.542270+00:00 shinyapps[7066955]: [1] "ncvar_get_inner: entering with (C-STYLE INTEGER ONLY) ncid= 3211264 varid= 14"
2025-02-21T18:41:14.546566+00:00 shinyapps[7066955]: [1] "ncvar_get_inner: following line is collapse_degen:"
2025-02-21T18:41:14.551304+00:00 shinyapps[7066955]: [1] TRUE
2025-02-21T18:41:14.555808+00:00 shinyapps[7066955]: [1] "ndims: 1"
2025-02-21T18:41:14.560241+00:00 shinyapps[7066955]: [1] "ncvar_get: varsize:"
2025-02-21T18:41:14.565003+00:00 shinyapps[7066955]: [1] 1
2025-02-21T18:41:14.569324+00:00 shinyapps[7066955]: [1] "ncvar_get_inner: start:"
2025-02-21T18:41:14.573768+00:00 shinyapps[7066955]: [1] 1
2025-02-21T18:41:14.578329+00:00 shinyapps[7066955]: [1] "ncvar_get_inner: count:"
2025-02-21T18:41:14.583142+00:00 shinyapps[7066955]: [1] 1
2025-02-21T18:41:14.587716+00:00 shinyapps[7066955]: [1] "ncvar_get: totvarsize: 1"
2025-02-21T18:41:14.592194+00:00 shinyapps[7066955]: [1] "ncvar_get_inner: getting var of type double id= 4"
2025-02-21T18:41:14.596936+00:00 shinyapps[7066955]: [1] "about to call Rsx_nc4_get_vara_double..."
2025-02-21T18:41:14.601413+00:00 shinyapps[7066955]: [1] "back from call to Rsx_nc4_get_vara_double..."
2025-02-21T18:41:14.605812+00:00 shinyapps[7066955]: [1] "ncvar_get_inner: C call returned 0"
2025-02-21T18:41:14.610705+00:00 shinyapps[7066955]: [1] "ncvar_get_inner: dim of directly returned array:"
2025-02-21T18:41:14.615078+00:00 shinyapps[7066955]: NULL
2025-02-21T18:41:14.619591+00:00 shinyapps[7066955]: [1] "ncvar_get_inner: will collapse degen dims if ndims > 0. ndims= 1 collapse_degen= TRUE precint= 4"
2025-02-21T18:41:14.624117+00:00 shinyapps[7066955]: [1] "ncvar_get: final dims of returned array:"
2025-02-21T18:41:14.628641+00:00 shinyapps[7066955]: [1] 1
2025-02-21T18:41:14.633253+00:00 shinyapps[7066955]: [1] "ncvar_get_inner: will now consider changing missing values to NA..."
2025-02-21T18:41:14.637878+00:00 shinyapps[7066955]: [1] "------------------------------"
2025-02-21T18:41:14.642210+00:00 shinyapps[7066955]: [1] "Here is new dim:"
2025-02-21T18:41:14.646685+00:00 shinyapps[7066955]: [1] "Global index= 1 name= time len= 1 unlim= FALSE id= 0 dimvarid= 14 units= hours since 2025-01-07"
2025-02-21T18:41:14.651238+00:00 shinyapps[7066955]: [1] "------------------------------"
2025-02-21T18:41:14.655624+00:00 shinyapps[7066955]: [1] ".......nc_open: done processing dim time"
2025-02-21T18:41:14.660156+00:00 shinyapps[7066955]: [1] "nc_open: getting dim info for dim number 2 in group " " dim ID= 1"
2025-02-21T18:41:14.665091+00:00 shinyapps[7066955]: [1] ".....dim name is y id= 1 len= 1249 dimvarid= 16"
2025-02-21T18:41:14.669718+00:00 shinyapps[7066955]: [1] "nc_open: getting dimvar info for dim y"
2025-02-21T18:41:14.674186+00:00 shinyapps[7066955]: [1] "ncvar_get_inner: entering with (C-STYLE INTEGER ONLY) ncid= 3211264 varid= 16"
2025-02-21T18:41:14.678734+00:00 shinyapps[7066955]: [1] "ncvar_get_inner: following line is collapse_degen:"
2025-02-21T18:41:14.683215+00:00 shinyapps[7066955]: [1] TRUE
2025-02-21T18:41:14.688307+00:00 shinyapps[7066955]: [1] "ndims: 1"
2025-02-21T18:41:14.692879+00:00 shinyapps[7066955]: [1] "ncvar_get: varsize:"
2025-02-21T18:41:14.698852+00:00 shinyapps[7066955]: [1] 1249
2025-02-21T18:41:14.703459+00:00 shinyapps[7066955]: [1] "ncvar_get_inner: start:"
2025-02-21T18:41:14.707972+00:00 shinyapps[7066955]: [1] 1
2025-02-21T18:41:14.712569+00:00 shinyapps[7066955]: [1] "ncvar_get_inner: count:"
2025-02-21T18:41:14.717062+00:00 shinyapps[7066955]: [1] 1249
2025-02-21T18:41:14.721885+00:00 shinyapps[7066955]: [1] "ncvar_get: totvarsize: 1249"
2025-02-21T18:41:14.726881+00:00 shinyapps[7066955]: [1] "ncvar_get_inner: getting var of type float id= 3"
2025-02-21T18:41:14.731514+00:00 shinyapps[7066955]: [1] "about to call Rsx_nc4_get_vara_double..."
2025-02-21T18:41:14.736374+00:00 shinyapps[7066955]: [1] "back from call to Rsx_nc4_get_vara_double..."
2025-02-21T18:41:14.741216+00:00 shinyapps[7066955]: [1] "ncvar_get_inner: C call returned 0"
2025-02-21T18:41:14.746088+00:00 shinyapps[7066955]: [1] "ncvar_get_inner: dim of directly returned array:"

I do not see nothing weird

-Lorena

I just tried another experiment with your code. Following your instructions in the first post, I selected the 01H data set and a date and downloaded the data. Once the data was downloaded, I switched to the second tab, selected a series and then a map (date), and waited until all three output boxes had been filled. Then I changed the series selection, clicked the button and the application crashed.

So perhaps there is an issue in your code that results in an exception/error if the series button is clicked when the map selection is not null? Does that sequence of operations (choose series, choose map, change series) work correctly when you run the application locally? If so, is it possible that something is set in memory locally but not on the server?

Paul,

Thank you very much for your help. Yes, the problem you describe in the first sentence is what happens when the app is running in shinyapps.io. When I run it locally I do not have this crashing problem.

I got a message from Posit Support that part says:

In addition, I do see a log line that is likely related to a current incident.

2025-02-21T22:27:35.126188+00:00 shinyapps[7066955]: System has not been booted with systemd as init system (PID 1). Can't operate.
2025-02-21T22:27:35.129883+00:00 shinyapps[7066955]: Failed to connect to bus: Host is down

We are currently facing an incident on http://shinyapps.io/ that is affecting some users when trying to start or restart their applications. Posit Status - Errors restarting shinyapps.io applications. Please know that our engineers are actively investigating this issue, and we appreciate your patience during this time.

Could be something of shinyapps.io then? Or I could do something to fix it?

Thanks,

-Lorena

In some output of the app I have:

req(variable())

where variable is an eventReactive that reacts with the click.

Do you think that this kind of things could crash it?

Lorena,

I'm not positive, but I do not think that the issue described by the support team would explain what is going on with your application. You have no trouble starting it, and clicking buttons in the "wrong" order should not involve a restart.

As for using the req() function, that in itself would not crash the application. It hypothetically could prevent computation of something whose absence in a different part of the code could cause a crash.

Paul

Paul,

Yes, I think you are right.

In addition, I think I fixed the problem. I basically did some code optimization, some things were a bit redundant. For some reason, this solved the problem of the app crashing on shinyapps.io. I never really figured out why it crashed though as it worked fine locally.

-Lorena

1 Like