I was running several shinyapps on my shiny server hosted on ubuntu (16.04) AWS EC2 instance till yesterday. Today I upgraded my R from 3.5.2 to R 4.0. In the process I removed all old packages and reinstalled all packages in a new libpath.
> .libPaths()
[1] "/R4packages" "/usr/lib/R/site-library" "/usr/lib/R/library"
This new path where all R 4.0.1 packages are is: /R4packages
A directory listing with ls -ld /
shows up as:
drwxrwxr-- 103 rstudio rstudio 4096 Jun 17 16:21 R4packages
All the shiny apps are running fine from inside rstudio but failing when accessed from the browser as <ip address>:3838/myapp
. This used to run earlier.
A major clue is that everytime the shiny server log contains the exact same text for all the apps. Surprisingly the error message points to the package digest
while I do not use digest package in most of my apps. Perhaps in a few I used digest but the failure occurs for non digest apps too.
$ tail poll-rstudio-20200617-170252-41173.log
Error in loadNamespace(name) : there is no package called ‘digest’
Calls: local ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted
Just to confirm the package digest is installed in the primary libpath:
x1[grepl("dig",Package),.(Package,Version,LibPath)]
# x1 is a data.table containing all installed packages)
Package Version LibPath
1: digest 0.6.25 /R4packages
I have spent several hours tweaking my conf
file. None of the changes I did had any affect on the error message. The current version of the conf file is as follows:
$ sudo cat /etc/shiny-server/shiny-server.conf
# adding this line to preserve logs preserve_logs true; location /home { run_as :HOME_USER:; user_dirs; } # Define a server that listens on port 3838 server { listen 3838; # Define a location at the base URL location /home/rstudio/ShinyApps { run_as rstudio; # adding this line to avoid the annoying time expiry disconections app_idle_timeout 0; # Host the directory of Shiny Apps stored in this directory site_dir /srv/shiny-server; # Log all Shiny output to files in this directory log_dir /var/log/shiny-server; # When a user visits the base URL rather than a particular application, # an index of the applications available in this directory will be shown. directory_index on;
}
}
I have changed run_as to rstudio
and I have removed user_dirs
before adding it back.
Note: site_dir
value is untweaked as the apps are all linked into that directory.
My suspicion is that the package directory /R4packages
is still not being recognised and digest
may be the first package it tried to load every time.
Any pointers at how to troubleshoot this would be highly appreciated.