core icon indicating copy to clipboard operation
core copied to clipboard

Proxy read timeout can be exceeded by notifications using web sockets

Open vianneychacon opened this issue 9 years ago • 7 comments

Web socket connections may hit the proxy read timeout limit set by a proxy server. In that case, the client will receive no notifications once the connection is dropped.

Expected Behavior

The client should consistently receive notifications even when the application is behind a proxy server

Current Behavior

When the read timeout is reached, the client stops to receive notifications on the backend

Possible Solution

The connection is closed if the proxied server does not transmit any data between the timeout period. The proxied server can send websocket ping frames to reset the timeout.

Known Workarounds

Use fallback notifications

Steps to Reproduce (for bugs)

  1. Login into the backend and verify the events connections is made through ws
  2. Generate a notification (e.g. reindex) in less than the read timeout value to verify is notifying properly
  3. Wait until the timeout is reached and try again

Context

Running dotCMS behind a proxy server

Your Environment

  • dotCMS version used: 4.0.1 (dist)
  • Browser Name and version: Chrome
  • Operating System and version: Linux
  • Java Brand and version: OpenJDK 1.8.0_121-b13

vianneychacon avatar Apr 19 '17 16:04 vianneychacon

I think from the config perspective we can try to see if the timeout and keepalive helps. In our side, we will implement a Ping/Pong strategy; I consider by default is should be turn off and can be turn on by configuration.

jdotcms avatar Apr 19 '17 17:04 jdotcms

we have implemented a ping/pong strategy to keep connections websockets alive @john-thomas-dotcms these are the configuration variables important to document

dotcms.websocket.usepingpong=true dotcms.websocket.millis.pingpong=10000

usepingpong in true (by default false, but it can change) means the ping pong strategy works on dotcms, by default dotCMS do not use pingpong

millis.pingpong is the time to wait for send the ping message (in milli seconds), it could be a better strategy to use half of the seconds you have for timeout.

jdotcms avatar Apr 27 '17 19:04 jdotcms

PR: https://github.com/dotCMS/core/pull/11422

jcastro-dotcms avatar Apr 27 '17 20:04 jcastro-dotcms

Doc: https://auth.dotcms.com/docs/latest/authentication-using-jwt#Proxy

john-thomas-dotcms avatar May 02 '17 14:05 john-thomas-dotcms

PR: https://github.com/dotCMS/core/pull/11598 https://github.com/dotCMS/core/pull/11649

jgambarios avatar May 17 '17 13:05 jgambarios

Internal report: https://my.dotcms.com/tickets/detail.dot?id=47b202ac-c1c0-4f25-bc8a-35cc84ea1f3e

gabbydotCMS avatar May 31 '17 17:05 gabbydotCMS

Fixed, tested by @vianneychacon in cloud environment and seems that now is working better

bryanboza avatar Jun 02 '17 16:06 bryanboza