Shiny Server Pro crash with `updateQueryString`, `updateTabItems`

I have a problem with a crashing app on shiny server pro that runs completely fine locally (not a single crash).

I cannot reproduce the problem with a small app, but I will give as much info as possible:

We have a shiny app deployed on Shiny Server Pro (version 1.5.11.994), running R 3.6.0 (further below the full devtools::session_info).

The app includes links to properties (i.e. buildings) that are shown in a separate tabItem (this is using shinydashboard), using a hard link make with updateQueryString, for example if the user wants to inspect property with id = id, we use:

updateQueryString(glue("#/tabCasus/{id}"), mode = "push")

Then, we have an observeEvent that activates the sidebar tab, like so (slightly simplified):

observeEvent(getUrlHash(), {
    hash <- substring(getUrlHash(), 2)
    
    cat(file=stderr(), paste("Current hash:", hash), "\n")
    
    s <- strsplit(hash, "/")[[1]]
    entity_type <- s[2]
    
    updateTabItems(session, "sidebar", entity_type)
    
  })

Normally, and when the app is run locally, this allows text links like glue('<a href="#/tabCasus/{id}">'), which we use inside datatable's and elsewhere to link to properties.

Clicking a link inside the app will make the URL change to, e.g.:

site.ourdomain.net/ourapp/#/tabCasus/5656BB_1_

Locally the app works without a problem, but deployed on Shiny Server Pro it crashes after the URL does not switch nicely to the above, but rather something like:

site.ourdomain.net/ourapp/_w_93eac17e0bb80fa6b911df65670d0d0ca93452470b18b808/#/tabCasus/5656BB_1_

Why does the URL switch to this version, but not always? Hovering over any link in the app always shows the hashed bit, but after clicking on it it usually does not show up in the browser URL.

The shiny server logs at /var/log/shiny-server/ don't say anything (no warnings or errors on the R side.).

The JS log in my browser (I have tested both Chrome and Edge) complain about web sockets, but irregularly. For example:

That second warning I always see, the first one rarely.

And finally, I sometimes get this error (but not always):

Uncaught TypeError: Cannot read property 'readyState' of null

(again, in the JS console in Chrome).

Any hints,ideas? Thanks!!

Remko Duursma

─ Session info ───────────────────────────────────────────────────────────────
 setting  value
 version  R version 3.6.0 (2019-04-26)
 os       Ubuntu 16.04.6 LTS
 system   x86_64, linux-gnu
 ui       X11
 language (EN)
 collate  en_US.UTF-8
 ctype    en_US.UTF-8
 tz       Etc/UTC
 date     2019-07-16

─ Packages ───────────────────────────────────────────────────────────────────
 package            * version date       lib
 assertthat           0.2.1   2019-03-21 [1]
 backports            1.1.4   2019-04-10 [1]
 bit                  1.1-14  2018-05-29 [1]
 bit64                0.9-7   2017-05-08 [1]
 blob                 1.2.0   2019-07-09 [1]
 broom                0.5.2   2019-04-07 [1]
 callr                3.3.0   2019-07-04 [1]
 cellranger           1.1.0   2016-07-27 [1]
 class                7.3-15  2019-01-01 [3]
 classInt             0.3-3   2019-04-26 [1]
 cli                  1.1.0   2019-03-19 [1]
 colorspace           1.4-1   2019-03-18 [1]
 config             * 0.3     2018-03-27 [1]
 crayon               1.3.4   2017-09-16 [1]
 crosstalk            1.0.0   2016-12-21 [1]
 data.table           1.12.2  2019-04-07 [1]
 DBI                * 1.0.0   2018-05-02 [1]
 dbplyr             * 1.4.2   2019-06-17 [1]
 desc                 1.2.0   2018-05-01 [1]
 devtools           * 2.1.0   2019-07-06 [1]
 digest               0.6.20  2019-07-04 [1]
 dplyr              * 0.8.3   2019-07-04 [1]
 dqshiny            * 0.0.3   2019-02-05 [1]
 DT                 * 0.7     2019-06-11 [1]
e1071                1.7-2   2019-06-05 [1]
 forcats            * 0.4.0   2019-02-17 [1]
 formatR              1.7     2019-06-11 [1]
 fs                   1.3.1   2019-05-06 [1]
 futile.logger      * 1.4.3   2016-07-10 [1]
 futile.options       1.0.1   2018-04-20 [1]
 generics             0.0.2   2018-11-29 [1]
 ggplot2            * 3.2.0   2019-06-16 [1]
 glue               * 1.3.1   2019-03-12 [1]
 gtable               0.3.0   2019-03-25 [1]
 haven                2.1.1   2019-07-04 [1]
 hms                  0.5.0   2019-07-09 [1]
 htmltools            0.3.6   2017-04-28 [1]
 htmlwidgets          1.3     2018-09-30 [1]
 httpuv               1.5.1   2019-04-05 [1]
 httr                 1.4.0   2018-12-11 [1]
 jsonlite             1.6     2018-12-07 [1]
 KernSmooth           2.23-15 2015-06-29 [1]
 lambda.r             1.2.3   2018-05-17 [1]
 later                0.8.0   2019-02-11 [1]
 lattice              0.20-38 2018-11-04 [1]
 lazyeval             0.2.2   2019-03-15 [1]
 leaflet            * 2.0.2   2018-08-27 [1]
 leaflet.extras     * 1.0.0   2018-09-24 [1]
 lubridate          * 1.7.4   2018-04-11 [1]
 magrittr             1.5     2014-11-22 [1]
 memoise              1.1.0   2017-04-21 [1]
 mime                 0.7     2019-06-11 [1]
 modelr               0.1.4   2019-02-18 [1]
 munsell              0.5.0   2018-06-12 [1]
nlme                 3.1-140 2019-05-12 [1]
 pillar               1.4.2   2019-06-29 [1]
 pkgbuild             1.0.3   2019-03-20 [1]
 pkgconfig            2.0.2   2018-08-16 [1]
 pkgload              1.0.2   2018-10-29 [1]
 pool               * 0.1.4.2 2019-01-07 [1]
 prettyunits          1.0.2   2015-07-13 [1]
 processx             3.4.0   2019-07-03 [1]
 promises             1.0.1   2018-04-13 [1]
 ps                   1.3.0   2018-12-21 [1]
 purrr              * 0.3.2   2019-03-15 [1]
 R6                   2.4.0   2019-02-14 [1]
 Rcpp                 1.0.1   2019-03-17 [1]
 readr              * 1.3.1   2018-12-21 [1]
 readxl               1.3.1   2019-03-13 [1]
 remotes              2.1.0   2019-06-24 [1]
 rintrojs           * 0.2.2   2019-05-29 [1]
 rlang                0.4.0   2019-06-25 [1]
 rlist              * 0.4.6.1 2016-04-04 [1]
 RPostgreSQL        * 0.6-2   2017-06-24 [1]
 rprojroot            1.3-2   2018-01-03 [1]
 RSQLite            * 2.1.1   2018-05-06 [1]
 rstudioapi           0.10    2019-03-19 [1]
 rvest                0.3.4   2019-05-15 [1]
 scales               1.0.0   2018-08-09 [1]
 sessioninfo          1.1.1   2018-11-05 [1]
 sf                 * 0.7-6   2019-07-05 [1]
 shiny              * 1.3.2   2019-04-22 [1]
 shinyalert         * 1.0     2018-02-12 [1]
 shinycssloaders    * 0.2.0   2017-05-12 [1]
 shinydashboard     * 0.7.1   2018-10-17 [1]
 shinydashboardPlus * 0.7.0   2019-04-08 [1]
 shinyjs            * 1.0     2018-01-08 [1]
shinyWidgets       * 0.4.8   2019-03-18 [1]
 sp                 * 1.3-1   2018-06-05 [1]
 stringi              1.4.3   2019-03-12 [1]
 stringr            * 1.4.0   2019-02-10 [1]
 testthat             2.1.1   2019-04-23 [1]
 tibble             * 2.1.3   2019-06-06 [1]
 tidyr              * 0.8.3   2019-03-01 [1]
 tidyselect           0.2.5   2018-10-11 [1]
 tidyverse          * 1.2.1   2017-11-14 [1]
 units                0.6-3   2019-05-03 [1]
 usethis            * 1.5.1   2019-07-04 [1]
 vctrs                0.2.0   2019-07-05 [1]
 withr                2.1.2   2018-03-15 [1]
 writexl            * 1.1     2018-12-02 [1]
 xml2                 1.2.0   2018-01-24 [1]
 xtable               1.8-4   2019-04-21 [1]
 yaml                 2.2.0   2018-07-25 [1]
 zeallot              0.1.0   2018-01-28 [1]

Hi,

Although this Shiny question is way out of my comfort zone (and knowledge) I have one thing that pops into mind and I can share for whatever it's worth :slight_smile:

My first thought was that because you're running it on a server and not locally, Shiny probably has different instances and sessions of the app to accommodate simultaneous access. Maybe this generates extra variables in the links to the app that mess with / override with that #

Anyway, it's a vague guess, so I might be completely wrong, but who knows it might help...

Grtz,
PJ

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