OasisLMF / OasisPlatform

Loss modelling platform.
BSD 3-Clause "New" or "Revised" License
40 stars 17 forks source link

Oasis UI - idle session crash #652

Open sambles opened 2 years ago

sambles commented 2 years ago

Issue Description

An authentication issue with keycloak causes the UI app to crash after a short period of time ~ 3-4 mins

Steps to Reproduce (Bugs only)

  1. Login (works)
  2. Idle for a few mins on any page
  3. UI app grey out crashes

Version / Environment information

UI 1.11.3 Newer platform build (platform-2.0)

sambles commented 2 years ago

Update: testing by @RolandASc points to a connection problem internal to the cluster. External UI apps connecting via HTTPS don't show this problem.

Follow up is to look at the ingress nginx configuration

sambles commented 2 years ago

https://www.keycloak.org/docs/latest/server_installation/index.html#_setting-up-a-load-balancer-or-proxy

https://kubernetes.github.io/ingress-nginx/

https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/

sambles commented 2 years ago

Something is wonky with the websocket connection

Screenshot from 2022-09-14 14-38-51

https://www.civo.com/learn/using-websockets-with-ingress-controller https://stackoverflow.com/questions/52883653/nginx-ingress-controller-websocket-support#52884066

sambles commented 2 years ago

The above happens with firefox after an connection Upgrade request to the websocket:

x.x.x.x     - - [15/Sep/2022:08:47:56 +0000] "GET /websocket/ HTTP/1.1" 101 8387 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:103.0) Gecko/20100101 Firefox/103.0" 651 262.311 [default-oasis-ui-8080] [] 10.240.0.21:3838 0 262.312 101 eada5b797fb74856da7abec2d04afc42
10.240.0.30 - - [15/Sep/2022:08:48:01 +0000] "GET /auth/realms/oasis/protocol/openid-connect/userinfo HTTP/1.1" 200 226 "-" "python-requests/2.26.0" 1773 0.007 [default-keycloak-8080] [] 10.240.0.12:8080 226 0.008 200 913bbd6c200667a9dddd7859bac7dc15               

Seems similar to, the following and only happens when the Shiny app is behind a proxy server. https://github.com/rstudio/rstudio/issues/2940 https://github.com/rstudio/shiny/issues/2925

dholdaway commented 2 years ago

hello,

could you think about using traefik instead of nginx ?

idle session crashes also behind a ALB on AWS.

happy to help out on this issue if needs be?

sambles commented 2 years ago

Hi @dholdaway thanks for the pointer, i'll give traefik a try. My other thought was placing shinyproxy between the UI application and ingress.

benhayes21 commented 7 months ago

Darren has had luck switching ingress to traefk. Rodney to try