Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] Ajax error after long time idle with auth enabled #137

Closed
shrektan opened this issue Mar 25, 2019 · 10 comments
Closed

[Bug Report] Ajax error after long time idle with auth enabled #137

shrektan opened this issue Mar 25, 2019 · 10 comments
Labels
Milestone

Comments

@shrektan
Copy link
Contributor

For example, let's say you have the below simple app. Note that the DT table uses ajax when server = TRUE (the server processing mode).

library(shiny)
ui <- fluidPage(DT::DTOutput('tbl'))
server <- function(input, output, session) {
  output$tbl <- DT::renderDT(iris, server = TRUE)
}
runApp(list(ui = ui, server = server))

When with auth enabled (any auth methods), you open the browser and enter the app and everything works fine (like click the page button below the table). However, after long time idle (30 mins or 1 hour), click the page button you will find DT complaints the ajax error. The way to solve is simple: refresh the page or just open a new connection to Shinyproxy and perform the re-login. But it confuses the users a lot.

This is because after long time idle, Shinyproxy requires you to re-login for the new connection but the existing connection is still valid. It has the side-affect that the AJAX posting which the existing app trying to perform will be rejected by the server, because Shinyproxy regards it as a new connection...

The way to solve this I believe is to

  • either disconnect the existing apps whenever the re-login requires (a.k.a, a timeout), or
  • recognize the AJAX connection performed by the existing app as valid / authorized...

Thanks.

@dylancis
Copy link

@shrektan I had similar issues, and OpenAnalytics helped me to fix this:
Change the undertow timeout (which by default is 30 minutes).

server:
  servlet.session.timeout: 3600

The below are in seconds - set it to 0 if you do not ant any timeout.
Thanks, Dylan

@shrektan
Copy link
Contributor Author

@dylancis Thanks for the workaround! Appreciated!

However, I'll leave the issue open because IMHO, it's better to disconnect the existing app when the session is timeout.

@shrektan
Copy link
Contributor Author

shrektan commented Mar 25, 2019

@dylancis BTW, a little off-topic, have you tried the new release of Shinyproxy with DT tables? I haven't looked into the cause but I see the AJAX errors saying POST methods can't be accepted.

@dylancis
Copy link

@dylancis BTW, a little off-topic, have you tried the new release of Shinyproxy with DT tables? I haven't looked into the cause but I see the AJAX errors saying POST methods can't be accepted.

oups - no I did not yet.

@GeiserX
Copy link

GeiserX commented Mar 25, 2019

Also for me - I transitioned from 2.1 to 2.2 and now not even a single renderDataTable works. A lot of AJAX errors redirecting me to this page http://datatables.net/tn/7

@shrektan
Copy link
Contributor Author

shrektan commented Mar 25, 2019

I believe it’s a bug... Actually, open the developer tools and you can see the respond of the AJAX request - POST methods can't be accepted by the server but GET is ok...

@dylancis
Copy link

Hi @shrektan have you raised this apricot issue about DT ? We are planning to upgrade but our apps relies heavily on datatable library.

@shrektan
Copy link
Contributor Author

@dylancis Just filed a new issue about this bug at #140

@fmichielssen
Copy link
Member

As @dylancis mentioned, increasing server.servlet.session.timeout will avoid this issue.
But I agree that it would be better if the session timeout is delayed automatically as long as there is an open websocket channel (which triggers heartbeat and thus keeps the container alive).

Note: this comment is about session expiration resulting in 401 (unauthorized) responses. It is not about the ajax POST issue resulting in 405 (method not allowed) responses.

@LEDfan LEDfan added this to the Next milestone Jul 30, 2021
@LEDfan
Copy link
Member

LEDfan commented Nov 5, 2021

This is now fixed in ShinyProxy 2.6.0 (ContainerProxy 0.8.10)!

Thank you for the very useful bug report!

@LEDfan LEDfan closed this as completed Nov 5, 2021
arsenij-ust added a commit to buschlab/MTB-cbioportal that referenced this issue Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants