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

Websocket Timeout Not Being Honored #2578

Closed
jdonnell01 opened this issue Jun 11, 2020 · 7 comments
Closed

Websocket Timeout Not Being Honored #2578

jdonnell01 opened this issue Jun 11, 2020 · 7 comments
Labels
area/httpproxy Issues or PRs related to the HTTPProxy API. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. lifecycle/accepted Denotes an issue that has been triaged and determined to be valid.

Comments

@jdonnell01
Copy link

jdonnell01 commented Jun 11, 2020

I set the timeout for the websocket on my app to be 1800s, however it seems that HTTP Proxy/Contour is not honoring this value as the websocket will timeout randomly. I also tried setting it to infinity as described in the docs (https://projectcontour.io/docs/master/httpproxy/), however this did not work either. I am trying to run an R Shiny application (https://github.com/rstudio/shiny).

This is my HTTPProxy config:

apiVersion: projectcontour.io/v1
kind: HTTPProxy
metadata:
   name: simpleingress
spec:
      virtualhost:
         fqdn: <fqdn>
         tls:
            secretName: ingress-contour/ingress-contour-default-ssl-cert
     routes:
    - services:
        - name: simpleservice
          port: 8080
      loadBalancerPolicy:
        strategy: Cookie
      timeoutPolicy:
        response: infinity
        idle: infinity
    - conditions:
      - prefix: /websocket
      services:
        - name: simpleservice
          port: 8080
      enableWebsockets: true
      loadBalancerPolicy:
        strategy: Cookie
      timeoutPolicy:
        response: infinity
        idle: infinity
  • Contour version: 1.3
  • Kubernetes version: Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.7"

Thank you

@youngnick
Copy link
Member

Hi @jdonnell01, thanks for logging this issue.

One of the maintainers will need to see if we can reproduce the issue to see if we can track it down. Is there anything else you can tell us about the service you're doing websockets with? Any idea of what timeout is being enforced? Thanks for any extra info you can provide.

@youngnick youngnick added area/httpproxy Issues or PRs related to the HTTPProxy API. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. lifecycle/accepted Denotes an issue that has been triaged and determined to be valid. labels Jun 22, 2020
@jdonnell01
Copy link
Author

Hi @youngnick. I am using the following libraries:

HTTR (Underlying Framework for Creating WebSockets): https://github.com/r-lib/httr
Shiny (Web Framework which creates the websocket): https://github.com/rstudio/shiny

Code for initiating the websocket: https://github.com/rstudio/shiny/blob/e7ec5e5ba4915a4bf57ac8f21166ea916b44e379/srcjs/shinyapp.js#L80

I no longer think it's a timeout as the app will actually disconnect during normal use. However, something on the proxy is causing the websocket to sporadically close.

@stevesloka
Copy link
Member

Hey @jdonnell01 we just merged support for configuring some various timeouts, in particular: #2632. Would you be able to try out a master build of Contour in your environment?

@jdelgadillo
Copy link

We've run into this issue as well. There is a sample Play App + Docker + kubernetes config here: https://github.com/mzesri/contour-sample

Which version of contour do we need to install? Which annotations should we be looking at?

@jpeach
Copy link
Contributor

jpeach commented Aug 25, 2020

Testing the HTTPProxy config in the initial report. The following Envoy config is generated:

        "routes": [
         {
          "match": {
           "prefix": "/websocket"
          },
          "route": {
           "cluster": "default/ingress-conformance-echo/80/e4f81994fe",
           "timeout": "0s",
           "hash_policy": [
            {
             "cookie": {
              "name": "X-Contour-Session-Affinity",
              "ttl": "0s",
              "path": "/"
             }
            }
           ],
           "idle_timeout": "0s",
           "upgrade_configs": [
            {
             "upgrade_type": "websocket"
            }
           ]
          }
         },

Note that the 0s for timeout and idle_timeout means that the corresponding timeout is disabled. max_stream_duration is not set, so it should not be applied.

https://www.envoyproxy.io/docs/envoy/latest/api-v2/api/v2/route/route_components.proto#envoy-api-msg-route-routeaction

You should be using the latest Contour release (1.7.0). I think the next step here is a reproducible set of steps to validate this using the current release.

@jdelgadillo
Copy link

This is the HTTPProxy we're using:

---
apiVersion: projectcontour.io/v1
kind: HTTPProxy
metadata: 
  name: playapp-ingress-route 
  namespace: default
spec: 
  virtualhost:
    fqdn: a4iot-mingwebsockettest.westus2.cloudapp.azure.com
    tls:
      secretName: a4iot-cert
      minimumProtocolVersion: "1.2"
  routes: 
    - conditions:
      - prefix: /prefix/
      timeoutPolicy:
        response: 900s
        idle: 900s
      enableWebsockets: true
      permitInsecure: true
      services:
        - name: playapp-service
          port: 80
      pathRewritePolicy:
        replacePrefix:
          - prefix: /prefix/
            replacement: /
      retryPolicy:
        count: 3

Should the idle attribute work as expected with v1.7.0? (Our deployments are currently using v1.3.0)

@sunjayBhatia
Copy link
Member

closing due to inactivity, please reopen a new issue with details if you still have issues with this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/httpproxy Issues or PRs related to the HTTPProxy API. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. lifecycle/accepted Denotes an issue that has been triaged and determined to be valid.
Projects
None yet
Development

No branches or pull requests

6 participants