I have the shiny application deployed on the Rshiny pro server(1.5.2)
.
Application does some heavy computations and generates the report without any problem if it gets completed before approximately 45 seconds
.
If the computation and report generation goes beyond approximately 45 seconds, user's session / connection to the server is getting interrupted. Then automatically server is reconnecting
the disconnected users almost immediately. After few seconds of re-connection
the user session is getting reaped and user is presented with the notwork error.
From above observations we know that the reconnect
flag is enabled
at the server.
I need help to understand-
- Why the user session is getting interrupted around approximately
45 seconds
every single time. - How to prevent this session interruption? Is there any configuration at server or application side which will help me achieve uninterrupted session between user and server?
Well, after searching and trying out different options I was able to find the answers to my questions.
- The user session was getting interrupted around approximately 45 seconds every single time because the
http_keepalive_timeout
parameter was not defined in theserver configuration
and thedefault value
forhttp_keepalive_timeout
parameter is45 seconds
. To prevent the session from getting reaped before the report generation, I added the
http_keepalive_timeout
parameter to theshiny-server.conf
at thetop level
and set it's value to120 seconds
as shown below.http_keepalive_timeout 120;
You can set the http_keepalive_timeout
value as per your wish. I set it to 120
as my application is taking around 100-110 seconds
to generate the report.
Reference: shiny server configuration
来源:https://stackoverflow.com/questions/45300285/user-session-is-getting-interrupted-after-approx-45-seconds