rstudio / shiny

Easy interactive web applications with R
http://shiny.rstudio.com
Other
5.35k stars 1.87k forks source link

Disconnected from server: The application unexpectedly exited. #4096

Open jk45019975 opened 2 months ago

jk45019975 commented 2 months ago

We have a web-based Shiny server application that is used to copy files in a virtual machine from Azure.

As a user, after visiting the application, I encounter an error in the UI showing Disconnected from Server with a reload option.

image (1)

Upon further inspection in the developer tools (Microsoft Edge) in console, I can see the message:

“The application unexpectedly exited. Diagnostic information is private. Please ask your system admin for permission if you need to check the R logs.”

We have a server.R file where I have set the log level to TRACE. However, we are not able to see the root cause, or any information related to the “Disconnected from Server” issue in these logs.

I would appreciate any suggestions on how we should monitor R logs to diagnose this issue. If anyone has faced a similar issue with their Shiny app, your help would be greatly appreciated.

Thanks in advance!

jcheng5 commented 2 months ago

The log file locations are here: https://docs.posit.co/shiny-server/#application-error-logs The short answer is /var/log/shiny-server/*.log.

If you find the right file and it abruptly terminates with no error at all, it’s most likely being killed by the operating system’s “oom-killer”, which you can confirm with this command: https://stackoverflow.com/a/15953500

kapoorakansha commented 2 weeks ago

@jcheng5 Can you please suggest amongst below processes which is the process that gets killed when the error "disconnected from server" occurs:

root@RMSP-SHINYVM:/home/shinyuser# ps -ef | grep shiny root 850 1 0 05:02 ? 00:00:01 /opt/shiny-server/ext/node/bin/shiny-server /opt/shiny-server/lib/main.js root 54251 850 0 07:27 ? 00:00:00 su -s /bin/bash --login -p -- shiny -c cd \/srv\/shiny-server\/od_steering_lab && R --no-save --slave -f \/opt\/shiny-server\/R\/SockJSAdapter.R shiny 54253 1 0 07:27 ? 00:00:00 /lib/systemd/systemd --user shiny 54254 54253 0 07:27 ? 00:00:00 (sd-pam) shiny 54259 54253 0 07:27 ? 00:00:00 /usr/bin/pulseaudio --daemonize=no --log-target=journal shiny 54260 54251 0 07:27 ? 00:00:05 /usr/lib/R/bin/exec/R --no-save --slave -f /opt/shiny-server/R/SockJSAdapter.R shiny 54270 54253 0 07:27 ? 00:00:00 /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only root 94239 1106 0 10:25 ? 00:00:00 sshd: shinyuser [priv] shinyus+ 94260 1 0 10:25 ? 00:00:00 /lib/systemd/systemd --user shinyus+ 94261 94260 0 10:25 ? 00:00:00 (sd-pam) shinyus+ 94267 94260 0 10:25 ? 00:00:00 /usr/bin/pulseaudio --daemonize=no --log-target=journal shinyus+ 94285 94260 0 10:25 ? 00:00:00 /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only shinyus+ 94386 94239 0 10:25 ? 00:00:00 sshd: shinyuser@pts/0 shinyus+ 94387 94386 0 10:25 pts/0 00:00:00 -bash root 97094 850 0 10:41 ? 00:00:00 su -s /bin/bash --login -p -- shiny -c cd \/srv\/shiny-server\/sample-apps\/PELE_Shiny && R --no-save --slave -f \/opt\/shiny-server\/R\/SockJSAdapter.R shiny 97095 97094 0 10:41 ? 00:00:01 /usr/lib/R/bin/exec/R --no-save --slave -f /opt/shiny-server/R/SockJSAdapter.R root 98741 94791 0 10:50 pts/0 00:00:00 grep shiny

image