R Session Aborted / fatal error with Shiny

Hello! I updated R from version 4.3.3 to 4.4.2, and installed a few packages from CRAN in RStudio (using Tools -> Install packages), and I haven't been able to use shiny at all. Sometimes the rsession aborts before the shiny window opens (or launches in browser), sometimes after closing it; sometimes while creating a very simple ui function, though not always, even for the same ui function. The same thing happens for the "01_hello" example.

library(shiny)

ui <- fluidPage(
  titlePanel("Hello"),
  
  sidebarLayout(
    sidebarPanel(
      div(h4("Trying stuff"))
    ),
    
    mainPanel(
      div(h4("And things"))
    )
  )
)

server <- function(input, output){}

shinyApp(ui, server)

I still have the previous version of R and its library, so I tried different combinations of all of them: shiny works on both versions of R with the old library, but doesn't work on either version of R with the new library. I assume it's some type of incompatibility between packages versions, but I don't know which. I tried downgrading only shiny and it didn't work.

I've been closing RStudio in between each step, and I've also deleted any .RData files just in case.

If the idea is to downgrade packages, any suggestions as to where to start trying? I'll be using the older version in the meantime, but I'd like to use the newer versions eventually. This might not be an issue with shiny itself but something else breaking shiny, but I don't know how to go about it.

Thank you in advance. This is devtools::session_info() after loading library(shiny) but before running any code, because I don't know when the session will abort:

─ Session info ──────────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.4.2 (2024-10-31 ucrt)
 os       Windows 10 x64 (build 19045)
 system   x86_64, mingw32
 ui       RStudio
 language (EN)
 collate  English_United Kingdom.utf8
 ctype    English_United Kingdom.utf8
 tz       America/New_York
 date     2025-02-20
 rstudio  2024.12.1+563 Kousa Dogwood (desktop)
 pandoc   NA
 quarto   ERROR: Unknown command "TMPDIR=C:/Users/myname/AppData/Local/Temp/Rtmp0YD5WP/filec5c2fbf730f". Did you mean command "uninstall"? @ C:\\PROGRA~1\\RStudio\\RESOUR~1\\app\\bin\\quarto\\bin\\quarto.exe

─ Packages ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 package     * version date (UTC) lib source
 cachem        1.1.0   2024-05-16 [1] CRAN (R 4.4.2)
 cli           3.6.4   2025-02-13 [1] CRAN (R 4.4.2)
 devtools      2.4.5   2022-10-11 [1] CRAN (R 4.4.2)
 digest        0.6.37  2024-08-19 [1] CRAN (R 4.4.2)
 ellipsis      0.3.2   2021-04-29 [1] CRAN (R 4.4.2)
 fastmap       1.2.0   2024-05-15 [1] CRAN (R 4.4.2)
 fs            1.6.5   2024-10-30 [1] CRAN (R 4.4.2)
 glue          1.8.0   2024-09-30 [1] CRAN (R 4.4.2)
 htmltools     0.5.8.1 2024-04-04 [1] CRAN (R 4.4.2)
 htmlwidgets   1.6.4   2023-12-06 [1] CRAN (R 4.4.2)
 httpuv        1.6.15  2024-03-26 [1] CRAN (R 4.4.2)
 later         1.4.1   2024-11-27 [1] CRAN (R 4.4.2)
 lifecycle     1.0.4   2023-11-07 [1] CRAN (R 4.4.2)
 magrittr      2.0.3   2022-03-30 [1] CRAN (R 4.4.2)
 memoise       2.0.1   2021-11-26 [1] CRAN (R 4.4.2)
 mime          0.12    2021-09-28 [1] CRAN (R 4.4.0)
 miniUI        0.1.1.1 2018-05-18 [1] CRAN (R 4.4.2)
 pkgbuild      1.4.6   2025-01-16 [1] CRAN (R 4.4.2)
 pkgload       1.4.0   2024-06-28 [1] CRAN (R 4.4.2)
 profvis       0.4.0   2024-09-20 [1] CRAN (R 4.4.2)
 promises      1.3.2   2024-11-28 [1] CRAN (R 4.4.2)
 purrr         1.0.4   2025-02-05 [1] CRAN (R 4.4.2)
 R6            2.6.1   2025-02-15 [1] CRAN (R 4.4.2)
 Rcpp          1.0.14  2025-01-12 [1] CRAN (R 4.4.2)
 remotes       2.5.0   2024-03-17 [1] CRAN (R 4.4.2)
 rlang         1.1.5   2025-01-17 [1] CRAN (R 4.4.2)
 rstudioapi    0.17.1  2024-10-22 [1] CRAN (R 4.4.2)
 sessioninfo   1.2.3   2025-02-05 [1] CRAN (R 4.4.2)
 shiny         1.10.0  2024-12-14 [1] CRAN (R 4.4.2)
 urlchecker    1.0.1   2021-11-30 [1] CRAN (R 4.4.2)
 usethis       3.1.0   2024-11-26 [1] CRAN (R 4.4.2)
 vctrs         0.6.5   2023-12-01 [1] CRAN (R 4.4.2)
 xtable        1.8-4   2019-04-21 [1] CRAN (R 4.4.2)

 [1] C:/Users/myname/AppData/Local/R/win-library/4.4
 [2] C:/Program Files/R/R-4.4.2/library

─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Warning message:
In system2("quarto", "-V", stdout = TRUE, env = paste0("TMPDIR=",  :
  running command '"quarto" TMPDIR=C:/Users/myname/AppData/Local/Temp/Rtmp0YD5WP/filec5c2fbf730f -V' had status 1

PS: I realize there's an error and warning regarding quarto, which is a library I don't have, but I believe that's devtools looking for a version of something that doesn't exist, maybe? Couldn't find much info about that.

If you run the "hello" app in RStudio, does the console tab in RStudio show any error messages? Do the problems occur if you run the "hello" app from an R session run from a command prompt (outside RStudio)?

Thank you for the quick response.

The console tab in Rstudio does not show any error messages or warnings.

When I ran it from a command prompt: my ui function worked; the "01_hello" example partially worked at first, the menu loaded correctly but not the histogram plot; after that, neither my ui function nor the "hello" example worked. No warnings appeared in the command prompt either, it just "stopped listening" to the app.

(If I try to run the example without running my ui first, it just doesn't work).

I'm not sure how to interpret your last sentence, specifically the "running my ui first". Just to be clear, have you tried the following steps?

  1. Open a command prompt and run R.

  2. At the R prompt ("> "), execute shiny::runExample("01_hello").

  3. Assuming it works (or at least does not blow up), use Ctrl-C to stop the app when you are done with it.

This is what I get in the terminal (on Linux, not Windows, but should be pretty much the same for you).

> shiny::runExample("01_hello")
Loading required package: shiny

Attaching package: β€˜bslib’

The following object is masked from β€˜package:utils’:

    page


Listening on http://127.0.0.1:6907
^C

> 

I apologize about the ambiguity from before. I meant "running my ui" as in running that very simple reproducible example from my first post, which is an app that doesn't really do anything, it just has some titles.

Yes, I followed those steps exactly, and it does blow up. I get the same thing as you in the terminal, but the app doesn't work and it doesn't let me kill the process with Ctrl-C.

Do you get the "Listening ..." message in the terminal, is it using a local address (127.0.0.1 with some random port), and does the app open in your browser?

I'm struggling to think of a reason that Ctrl-C would not kill the app (assuming that the command window had focus when you typed Ctrl-C). Ctrl-C does not work if you run the app from the Console tab in RStudio, but it should work in a Windows command window, and it works in the Terminal tab of RStudio.

I believe Windows has a system monitor. Does it show the R session running and does it indicate anything goofy (all the memory being used, excessive CPU cycles, ...)?

Last thing: what version of the bslib package do you have?

Yes, the app opens in my browser, and I get the Listening on http://127.0.0.1:4295 message in the command prompt, or some other random port.

The system monitor shows a peak in CPU usage, and either a peak in frequency if the app disconnects or a plateau in high frequency if it doesn't disconnect (around 120% maximum freq). In that last case, I cannot kill the process with Ctrl-C, and I have to close the command prompt. Memory doesn't show anything weird in any case.

Finally, my bslib version is 0.9.0. I tried downgrading it to 0.8.0, but that didn't solve it either.

I can always try upgrading packages one by one from my older library, and see when it breaks. I don't think I can do this immediately, but if you think this is viable, I'll let you know if I find anything.

I'd be tempted to uninstall R 4.4.2 and all libraries, then reinstall R 4.4.2, and then (after making sure R and RStudio worked) use RStudio to install shiny (and all its dependencies) but nothing else. After that, see if 01_hello runs. I would hold off on installing devtools or anything else until the shiny app ran, in case maybe one of them is messing with a library shiny needs.

1 Like

That's exactly what I was doing, and it worked! Started with shiny and kept adding other packages with dependencies, including devtools, and it's all working.

I think I know where it went wrong before, but I don't know why. I tried the simplest thing, and managed to get an actual warning and error in RStudio:

> ui <- page_sidebar()
> server <- function(input, output){}
> shinyApp(ui, server)

Warning: Error in parse_string: 'Rf_installTrChar' must be called on a CHARSXP, but got 'symbol'
  3: runApp
  2: print.shiny.appobj
  1: <Anonymous>
Error in parse_string(txt, bigint_as_char) : 
  'Rf_installTrChar' must be called on a CHARSXP, but got 'symbol'

Rf_installTrChar apparently deals with system and foreign language, and when I first installed R 4.4.2, I deselected the option for "message translations". I assume it has to be that (or perhaps the package installation order).

But anyways, thank you very much for your help!

1 Like