Shiny Server periodic ERR_CONTENT_LENGTH_MISMATCH behind firewall.

184 views
Skip to first unread message

Bill Nussbaumer

unread,
Dec 21, 2016, 11:28:15 AM12/21/16
to Shiny - Web Framework for R
I've been banging my head against this problem for several days now and am really hoping for some direction to help solve. Since I don't know where the problem is originating it's difficult to know the best forum to ask for help so I'm starting here. I am also working in parallel with my IT department to get assistance.

I'm hosting a Shiny server on an Ubuntu 16.04 LTS VM in a Microsoft Azure subscription. I've set up Apache to act as reverse proxy to host both rstudio server and shiny server through port 80 per instructions on the rstudio site. (My corporate firewall blocks traffic outside of port 80) Rstudio server works fine.

Problem: When running apps that allow the user to upload a file, frequently, but unpredictably the app will crash. It is more common to see the crash when uploading multiple files in one batch, but it will also happen when uploading a single small file (~20kb). I have uploaded as many as 90 files of similar size at once, sometimes with success. Happy to follow up on any specific requests for config settings. I'm hoping the following clues will jump out at someone to point me in the right direction. Thanks.

Clues to tracking down the source of the error:

1. I only see the problem behind my corporate firewall. I can use the app with no issues from my home computer.
2. I hosted the application at shinyapps.io and it works great even from behind the firewall. (So I interpret this to mean I should be able to configure this somehow)
3. The included sample-apps, and any apps that do not require file upload work fine.
4. When I spin up a new VM, install R, then Shiny, change the host port to 80 but leave everything else at default ... I still have the problem.
5. I'm using an up to date version of Chrome and always when I load an app I get the following message, even when the app works. (I replaced my domain name with 'url')

WebSocket connection to 'ws://url/Shiny/uploadtest/__sockjs__/n=CSo4tDHrGWR4JWQEg4/200/dcuryf1t/websocket' failed: A server must not mask any frames that it sends to the client.
y.websocket               @ sockjs-0.3.4.min.js:27
y._try_next_protocol    @ sockjs-0.3.4.min.js:27
y._didClose                 @ sockjs-0.3.4.min.js:27
f._ir.onfinish                @ sockjs-0.3.4.min.js:27
f.emit                         @ sockjs-0.3.4.min.js:27
f.onfinish                    @ sockjs-0.3.4.min.js:27
f.emit                         @ sockjs-0.3.4.min.js:27
g.xhr.onreadystatechange @ sockjs-0.3.4.min.js:27

5. Only when the app crashes I get the following error:

POST http://url/Shiny/uploadtest/session/3bcb8bbc2126672cbc1901c18cfe9d15/upload/36076c87d14189a785e7ceb5?w= net::ERR_CONTENT_LENGTH_MISMATCH
send                                        @ jquery.min.js:4
ajax                                        @ jquery.min.js:4
onFile                                @ input_binding_fileinput.js:92
$run                                        @ file_processor.js:80
(anonymous)                        @ file_processor.js:50
(anonymous)                        @ input_binding_fileinput.js:82
(anonymous)                        @ shinyapp.js:610
_sendMessagesToHandlers @ shinyapp.js:521
dispatchMessage                 @ shinyapp.js:507
c.onmessage                         @ shinyapp.js:114
_conn.onmessage                 @ shiny-server-client.min.js:1
MultiplexClient._conn.onmessage @ shiny-server-client.min.js:1
BufferedResendConnection._handleMessage @ shiny-server-client.min.js:1
RobustConnection._handleMessage @ shiny-server-client.min.js:1
conn.(anonymous function)          @ shiny-server-client.min.js:2
d.dispatchEvent                          @ sockjs-0.3.4.min.js:27
y._dispatchMessage                  @ sockjs-0.3.4.min.js:27
y._didMessage                          @ sockjs-0.3.4.min.js:27
b.onmessage                          @ sockjs-0.3.4.min.js:27
d.dispatchEvent                          @ sockjs-0.3.4.min.js:27
c.xo.onchunk                          @ sockjs-0.3.4.min.js:27
f.emit                                  @ sockjs-0.3.4.min.js:27
g.xhr.onreadystatechange          @ sockjs-0.3.4.min.js:27

 

Bill Nussbaumer

unread,
Jan 4, 2017, 2:11:03 PM1/4/17
to Shiny - Web Framework for R

Success and I wanted to post the answer in my case for anyone that stumbles on this. It turns out our company firewall wasn't playing nice with Shiny over an http connection. We set up apache to serve a secure connection over TLS and everything now works fine.

Joe Cheng

unread,
Jan 4, 2017, 2:32:49 PM1/4/17
to Bill Nussbaumer, Shiny - Web Framework for R
Thanks for the update and sorry you didn't get a response. The holidays plus the upcoming RStudio conference has hurt our response rates.

Your solution makes sense. Corporate proxies often do all sorts of weird stuff to HTTP requests in an effort to be "helpful" (usually not to the end user but to IT, I guess), and HTTPS makes that generally impossible. We should probably start recommending this more strongly, especially now that free SSL certs are easily available.
On Wed, Jan 4, 2017 at 11:11 AM Bill Nussbaumer <bill...@gmail.com> wrote:

Success and I wanted to post the answer in my case for anyone that stumbles on this. It turns out our company firewall wasn't playing nice with Shiny over an http connection. We set up apache to serve a secure connection over TLS and everything now works fine.

--
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/11b6e8d7-093a-44e6-8e39-e0423922e6d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages