Skip to content

New TCP connection pool enforcing max_requests #19033

Closed

Description

@aminjam

Title: New TCP connection pool is not respecting max_connections for circuit-breaker's thresholds

Description:
After upgrading to envoy 1.19 we've been unable to serve more than 1024 downstream TCP connections. This seems to be coming from the new TCP connection pool. We've been able to mitigate this issue by using the older TCP connection pool.

Repro steps:
A detailed repro steps can be found in this gist: https://gist.github.com/aminjam/673aa9a4ed84f018febd7d95d9784bf0

Admin and Stats Output:
N/A

Config:
In summary, the following config.yaml will fail to serve more than 1024 connections as of envoy 1.19

node:
  cluster: proxy-cluster
  id: my-cluster
static_resources:
  secrets:
    - name: server_cert
      tls_certificate:
        certificate_chain:
          filename: certs/server.crt
        private_key:
          filename: certs/server.key
    - name: validation_context
      validation_context:
        trusted_ca:
          filename: certs/ca.crt
  clusters:
  - circuit_breakers:
      thresholds:
      - max_connections: 4294967295
    connect_timeout: 0.250s
    load_assignment:
      cluster_name: 0-service-cluster
      endpoints:
      - lb_endpoints:
        - endpoint:
            address:
              socket_address:
                address: 127.0.0.1
                port_value: 8080
    name: 0-service-cluster
    type: STATIC
  listeners:
  - address:
      socket_address:
        address: 127.0.0.1
        port_value: 61001
    filter_chains:
    - filters:
      - name: envoy.tcp_proxy
        typed_config:
          '@type': type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy
          cluster: 0-service-cluster
          stat_prefix: 0-stats
      transport_socket:
        name: listener-8080
        typed_config:
          '@type': type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext
          common_tls_context:
            alpn_protocols:
            - http/1.1
            tls_certificate_sds_secret_configs:
            - name: server_cert
            validation_context_sds_secret_config:
              name: validation_context
          require_client_certificate: false
    name: listener-8080
# uncomment below configuration to see the previous behavior
# layered_runtime:
#   layers:
#   - name: static-layer
#     static_layer:
#       envoy:
#         reloadable_features:
#           new_tcp_connection_pool: false

Logs:
N/A

Call Stack:
N/A

Activity

  1. added
    triage
    on Nov 17, 2021
  2. ggreenway commented on Nov 17, 2021

    @ggreenway
    Member
  3. self-assigned this
    on Nov 17, 2021
  4. alyssawilk commented on Nov 17, 2021

    @alyssawilk
    Contributor

    Ah, this is indeed a bug. Because of the shared code, both the max_requests knob is applies as well. The old pool enforced [max_connections, max_pending_requests] and the new enforces [max_connections, max_pending_requests, max_requests]
    I'll get a fix out soon to fix the behavioral inconsistency as well as updates to API documentation to make it clear when requests fields apply to connections.

    Meanwhile while I've regression tested the workaround I've suggested I'd appreciate you folks confirming it works for you as well. Also if you want to allow unlimited connections you may want to up your allowed pending requests for both the old and new pool!

  5. changed the title [-]New TCP connection pool is not respecting max_connections for circuit-breaker's thresholds[/-] [+]New TCP connection pool enforcing max_pending_requests[/+] on Nov 17, 2021
  6. changed the title [-]New TCP connection pool enforcing max_pending_requests[/-] [+]New TCP connection pool enforcing max_requests[/+] on Nov 17, 2021
  7. added a commit that references this issue on Nov 17, 2021
  8. added and removed
    triage
    on Nov 18, 2021
  9. added a commit that references this issue on Nov 18, 2021
  10. aminjam commented on Nov 18, 2021

    @aminjam
    Author

    Thanks @alyssawilk for fixing this issue. We have always used the docker built images to run envoy and we are not setup to build the binaries from the PR branches. Is there a docker image that builds PRs that we could consume? If not, just by looking at the PR and test coverage, it looks like it will fix this issue.

  11. alyssawilk commented on Nov 23, 2021

    @alyssawilk
    Contributor

    I think @ggreenway was going to build a backport so if this didn't miss the window we may be able to get it in

  12. added a commit that references this issue on Nov 29, 2021
    2bf8478
  13. added a commit that references this issue on Jan 13, 2022
    432807f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions