Disconnecting from the server

1,878 views
Skip to first unread message

LiFE is A BeACH

unread,
Jun 24, 2017, 10:46:09 AM6/24/17
to Shiny - Web Framework for R
Hi everyone,

every time I open the url of my deployed Application it appear the error message "disconnected from the server- Reload". Did some one know what causes this could have. 

Thanks in advance!

Joe Cheng

unread,
Jun 26, 2017, 3:42:46 PM6/26/17
to LiFE is A BeACH, Shiny - Web Framework for R
Can you tell us the URL? Or is it private?

--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/a4daa4ef-63c1-45a0-ae0f-b230a8965a37%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

LiFE is A BeACH

unread,
Jun 28, 2017, 7:58:38 AM6/28/17
to Shiny - Web Framework for R, nina.m...@gmail.com

Jeff van Geete

unread,
Jun 28, 2017, 1:36:19 PM6/28/17
to Shiny - Web Framework for R, nina.m...@gmail.com
I am having this issue but with the shiny-server service on my aws instance.  able to launch the app np from rstudio-server, but when I cp over to the /srv/shiny-server/ folder it disconnects after 1 second.  best of all, no logs.  

Joe Cheng

unread,
Jul 1, 2017, 9:18:04 AM7/1/17
to Jeff van Geete, Shiny - Web Framework for R, nina.m...@gmail.com
Nina, the first step would be to consult your app logs, which you can access through shinyapps.io or alternatively from your local RStudio project via rsconnect::showLogs() (or a similarly named function, sorry, I'm on my phone). If there is no error or warning in the logs, is it possible your app uses a lot of memory (RAM)? You will also get disconnected if the app is too big for your instance size, which you can enlarge also via shinyapps.io.

Jeff, are you looking under /var/log/shiny-server/*.log? (As opposed to /var/log/shiny-server.log) Do you see anything in your browser's JavaScript error console?

Pawan Dwivedi

unread,
Jan 29, 2018, 2:11:21 AM1/29/18
to Shiny - Web Framework for R
Did you find a solution to this? I am having the same issue. I am trying to run a shiny app on aws shiny-server. The app UI is loaded but within 2-3 seconds I get a 'Disconnected from the server. Reload' message. Checked into /var/log/shiny-server.log and /var/log/shiny-server/*.log but nothing useful there.

Joe Cheng

unread,
Jan 29, 2018, 10:45:19 AM1/29/18
to Pawan Dwivedi, Shiny - Web Framework for R
What do you see in /var/log/shiny-server/*.log? No errors at all? You may need to add the line "preserve_logs true;" to your shiny-server.conf file.

Pawan Dwivedi

unread,
Jan 30, 2018, 1:20:02 AM1/30/18
to Shiny - Web Framework for R
Thanks, it is resolved. I added 'preserve_logs true' to shiny_server.conf file and 'sanitize_error false' to app.R, then it started creating logs in /var/log/shiny-server/*.log.

Alla Sapozhnikova

unread,
Feb 12, 2018, 12:52:41 AM2/12/18
to Shiny - Web Framework for R
I am having the same issue. I keep getting the "Disconnected from the server: Reload message. This is how it looks in browser.



shiny-server.log seems to be clean. Here it is:
[2018-02-11 20:33:05.148] [INFO] shiny-server - Stopping listener on 0.0.0.0:3838
[2018-02-11 20:33:05.148] [INFO] shiny-server - Shutting down worker processes (with notification)
[2018-02-11 21:23:02.550] [INFO] shiny-server - Shiny Server v1.5.7.0 (Node.js v6.10.3)
[2018-02-11 21:23:02.552] [INFO] shiny-server - Using pidfile /data/shiny-server/run/shiny-server.pid
[2018-02-11 21:23:02.553] [INFO] shiny-server - Using config file "/etc/shiny-server/shiny-server.conf"
[2018-02-11 21:23:02.589] [INFO] shiny-server - Starting listener on 0.0.0.0:3838
[2018-02-11 21:30:39.034] [INFO] shiny-server - Stopping listener on 0.0.0.0:3838
[2018-02-11 21:30:39.035] [INFO] shiny-server - Shutting down worker processes (with notification)
[2018-02-11 21:31:22.573] [INFO] shiny-server - Shiny Server v1.5.7.0 (Node.js v6.10.3)
[2018-02-11 21:31:22.576] [INFO] shiny-server - Using pidfile /data/shiny-server/run/shiny-server.pid
[2018-02-11 21:31:22.576] [INFO] shiny-server - Using config file "/etc/shiny-server/shiny-server.conf"
[2018-02-11 21:31:22.614] [INFO] shiny-server - Starting listener on 0.0.0.0:3838

This is my app:
options(shiny.sanitize.errors = FALSE)
options(shiny.trace = TRUE)

library(shiny)
# Define UI for application that plots random distributions
#ui <- fluidPage(
ui <- bootstrapPage(
  "test",
 h3("URL components"),
  verbatimTextOutput("urlText"),
  "test",
browser()

)

server <- function(input, output,session) {

}

shinyApp(ui, server)
 
The app log shows the following:
 Listening on http://127.0.0.1:45704
SEND {"config":{"workerId":"","sessionId":"cc24c18a88fb9c8c8a049e7ef6b17b39","user":null}}

Execution halted


No error messages on the browser console. Browser log is attached.

This is my shiny-server.conf
# Instruct Shiny Server to run applications as the user "shiny"
run_as shiny;
preserve_logs true;
sanitize_errors false;

#app_init_timeout 60;
#app_idle_timeout 60;

#disable_protocols websocket xdr-polling xdr-streaming;


#disable_protocols websocket xdr-polling;

#disable_protocols xdr-streaming xhr-streaming iframe-eventsource iframe-htmlfile;

# Define a server that listens on port 3838
server {
  listen 3838;

  # Define a location at the base URL
  location /shiny {


    # Host the directory of Shiny Apps stored in this directory
    site_dir /data/shiny-apps;

    # 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 off;
  }
}


Any help is very much appreciated.

Thank you.
shiny.bsc.gwu.edu-1518414305205.log

Alla Sapozhnikova

unread,
Feb 12, 2018, 3:59:18 PM2/12/18
to Shiny - Web Framework for R

I added shiny trace option to a shiny server and attached the shiny-server.log with the trace. 

These lines seem to be the ones where the "disconnect" happens
[2018-02-11 15:50:18.153] [TRACE] shiny-server - Withholding event 'end' from robust connection osbbL9achGVuE0zJiz
[2018-02-11 15:50:18.153] [TRACE] shiny-server - Withholding event 'close' from robust connection osbbL9achGVuE0zJiz
[2018-02-11 15:50:23.084] [TRACE] shiny-server - Timeout expired. Killing process.
[2018-02-11 15:50:23.084] [TRACE] shiny-server - Interrupting process on socket port 41961
[2018-02-11 15:50:23.084] [TRACE] shiny-server - Sending SIGINT to 47676
[2018-02-11 15:50:23.130] [TRACE] shiny-server - Port 41961 returned
[2018-02-11 15:50:23.130] [TRACE] shiny-server - Port 41961 proxy closed
shiny_server_trace.log

Joe Cheng

unread,
Feb 12, 2018, 6:00:51 PM2/12/18
to Alla Sapozhnikova, Shiny - Web Framework for R
Those messages all seem normal--that's just what happens when the client disconnects from the server. What's surprising to me is the shiny-server.log showing that the server is shutting down and starting up so often; were you causing shiny-server to restart in those instances? Or rebooting the entire server?

Alla Sapozhnikova

unread,
Feb 12, 2018, 9:34:33 PM2/12/18
to Shiny - Web Framework for R
No, i did not do anything with the server, the log just shows the trace of what was happening when i was trying to run the hello app from the browser. Please note that nobody else was connected to the server or doing anything there.

Here is the corresponding trace from the hello app log
shiny@shiny:/home/shiny> cat /var/log/shiny-server/hello-shiny-20180211-155016-41961.log

Listening on http://127.0.0.1:41961
SEND {"config":{"workerId":"","sessionId":"c3ee046ea5cb4723f2d76eb564c94526","user":null}}

Execution halted

It looks to me that there is no data sent from the R session to the browser. And the only thing that happens right away is the error message "Disconnected from the server- Reload"

Enisha Eshwar

unread,
May 10, 2018, 5:48:14 AM5/10/18
to Shiny - Web Framework for R
I had faced a similar issue, adding a few pointers which might help someone.

2 of my requests from the Shiny app were pretty heavy and taking a long while ~25-30s (check network logs on browser). After a while connection would get terminated with the error as below:
{"type":"close","code":3000,"reason":"No response from heartbeat","wasClean":true}

Shiny has few params related to heartbeat. Setting them is what helped me. Increase the value of 'sockjs_heartbeat_delay' in shiny-server.conf to a large number and the disconnect issue was not seen anymore. 

Francesco

unread,
Sep 13, 2018, 8:01:28 AM9/13/18
to Shiny - Web Framework for R
Thanks for the tip, I am also struggling with disconnections - it would be interesting to know which combinations of `http_keepalive_timeout`,   `sockjs_heartbeat_delay`, and `sockjs_disconnect_delay` can work better with slow networks / aggressive proxies. My guest would have been to decrease the value of sockjs_heartbeat_delay, to keep the connection alive, but in your case you seem to get good results with larger values. I will try and see if it works for me as well.
Francesco
Reply all
Reply to author
Forward
0 new messages